Fumadocs
A documentation layout for sites on fumadocs-core, built from @contour-ui/react and installed in place of fumadocs-ui.
@contour-ui/fumadocs is the interface of a documentation site on Fumadocs,
built from the styled components: the sidebar and the header, the search, the
table of contents, the parts of a page and the components of its MDX. It takes the place of
fumadocs-ui, the interface Fumadocs ships: install one or the other, not both. This site runs
on it.
What comes from where
fumadocs-coregives the data: the page tree of the content (loader()), the table of contents of each page, the search index and the client that searches it. Its adapters (fumadocs-core/framework/*) give the links, the current path and the router of your framework, so the package works in any framework they cover, such as React Router, Next.js, TanStack Start and Waku.fumadocs-mdxcompiles the pages: their frontmatter, ids for their headings, code highlighted by Shiki, and the text the search indexes. Another content source offumadocs-coreworks too: the layouts need its page tree and the table of contents of each page.@contour-ui/fumadocsdraws it with the styled components and the tokens: the provider and the layouts from@contour-ui/fumadocs, the MDX components from@contour-ui/fumadocs/mdx, and one stylesheet,@contour-ui/fumadocs/styles.css.
What you get
- A docs layout. From 48rem, a sidebar with the sections of the docs, the pages of the current one in folders that open and close, and a button that collapses it; below, a header whose menu holds the same. Each page shows its title and description, the previous and the next page of its section, and its table of contents: a column beside the text from 80rem, a bar above it below. See Layouts.
- Search in a dialog, on the static index of
fumadocs-core: results grouped by page, the query highlighted, ⌘ K or Ctrl K from anywhere. See Search. - MDX components. Headings that link to themselves; links, tables and code blocks drawn by
the styled Link, Table and CodeBlock; code block tabs, and install commands for every package
manager;
Callout,Cards,Kbd,PreviewandTabson every page without an import; andProsefor the text. See MDX components. - Themes. Dark and light from the tokens, a toggle in the layouts, with the theme of the operating system as a third choice if you want it, the user's choice remembered and in place before the first paint. See Styling.
- Accessibility. Landmarks, a skip link, every control within reach of the keyboard, and focus where the reader is after a search or a menu.
- Server rendering. Pages prerender, render on a server, or render as React Server Components (Next.js App Router), and hydrate without a flash of the wrong theme or sidebar.
Install
npm install @contour-ui/fumadocs @contour-ui/react @contour-ui/tokens fumadocs-core fumadocs-mdxpnpm add @contour-ui/fumadocs @contour-ui/react @contour-ui/tokens fumadocs-core fumadocs-mdxyarn add @contour-ui/fumadocs @contour-ui/react @contour-ui/tokens fumadocs-core fumadocs-mdxbun add @contour-ui/fumadocs @contour-ui/react @contour-ui/tokens fumadocs-core fumadocs-mdxReact 19, React DOM 19 and fumadocs-core are peer dependencies. Setup
wires the package into React Router or Next.js.
Load the stylesheets
Import them once, at the root of the app, in this order:
import '@contour-ui/tokens/tokens.css';
import '@contour-ui/tokens/fonts.css';
import '@contour-ui/fumadocs/styles.css';
import '@contour-ui/react/styles.css';@contour-ui/fumadocs/styles.css starts with the order of every cascade layer of contour-ui, and
a layer ranks where it first appears. Loaded after @contour-ui/react/styles.css, the base of the
page and the typography of the content would rank above the components, and restyle them in your
pages.
Your own CSS comes last, outside any layer: it overrides every style of contour-ui. The layers, the classes and the variables you can override are on the Styling page.
In this section
React Router and Next.js: the provider, the inline script, the docs route and the search route.
DocsProvider, DocsLayout, DocsPage and HomeLayout, and the parts for a layout of your own.
What each Markdown element becomes, code block tabs, Prose, and Callout, Card, Preview and Tabs.
The static index, the dialog, its shortcut, and where a result leads.
The cascade layers, the public classes, the layout variables and the attributes of the page.