Installation
While the easiest way to start a new project with Prose UI is by cloning one of the templates, we provide the instructions below to help you set up a brand-new project with Prose UI on your own.
Here's how to create and configure a Next.js project with next/mdx and Prose UI.
Note that this is a very basic setup. For an example that uses an MDX bundler, content collections, and a separate MDX content folder, refer to our docs starter template.
Create a new project and install dependencies
Start by creating a Next.js project, choosing defaults in the prompts.
Note that if you're using @next/mdx, as we do in this example setup, you have to make sure your project is using Webpack and not Turbopack.
Next.js 16 comes with Turbopack by default, so you'll need to disable it explicitly when creating the project with the npx command above.
Enter your project’s folder and install the dependencies for rendering MDX and Prose UI. We're using pnpm, but feel free to use your preferred package manager.
Set up MDX components
Create an mdx-components.tsx file in the root of your project. This file will be used to override the default components used by MDX.
Set up MDX rendering
Configure your project to use MDX with Prose UI by modifying your next.config.ts in the following way:
Adjust the layout
Go to your app/layout.tsx and replace the content it returns with the code below to ensure that your pages have the correct fonts and styles applied.
Add Prose UI CSS styles
Next, go to your src/app/globals.css file and import Prose UI styles at the top:
The katex.min.css import is required only if you use math formulas.
Optional step: if you want to override fonts in Prose UI, update the variables for the base, heading, and mono fonts in your globals.css. For more details on styling, refer to the styling page.
Add MDX content
Rename src/app/page.tsx to src/app/page.mdx and replace the content with your Markdown/MDX. For example:
That's it! Run pnpm dev and open your project in the browser.