Getting started
Add docs to a Next.js project that uses shadcn/ui.
docscn supports Next.js projects that use shadcn/ui with Base UI (the base-* styles).
Create a project
If you don't have a project yet, create one with shadcn/ui and Base UI:
Add the registry
Add the @docscn registry to your components.json:
Install the docs block
The docs block installs every docscn component, plus everything a docs site needs:
lib/source.ts: loadscontent/docswith Fumadocs MDXlib/layout.shared.tsx: shared layout options (title, links, GitHub URL)components/mdx.tsx: the MDX componentsapp/docs/layout.tsxandapp/docs/[[...slug]]/page.tsx: the docs routesapp/api/search/route.ts: the search APIcontent/docs/index.mdxandmeta.json: a first page
Fumadocs MDX depends on esbuild, and pnpm 11 won't install a package with an
install script until you decide whether it may run. If the install stops with
ERR_PNPM_IGNORED_BUILDS, pnpm has added a placeholder line, esbuild: set this to true or false, under allowBuilds in pnpm-workspace.yaml. Change
it to esbuild: false (esbuild works without its script) and run the command
again.
Finish the setup
Two files need small edits the CLI can't make for you.
Wrap your app in RootProvider. It includes next-themes, so it replaces the ThemeProvider from shadcn/ui's template or dark mode guide:
Compile MDX with Fumadocs MDX:
Run it
Start the dev server and open localhost:3000/docs:
Write pages as .mdx files in content/docs, and order them with meta.json. See the Fumadocs docs for the page and meta.json conventions.
Install components one by one
You can also install components individually, for example:
Each component lists the shadcn/ui primitives and other docscn components it needs, and the CLI installs them too. See the component pages for what each one does.