Navigation
Configuring navigation elements
Layouts
Add links to Fumadocs UI layouts.
Page Tree
The page tree can be hardcoded, or generated by your content source (e.g. Fumadocs MDX).
It is passed to the Docs Layout component and shared to navigation elements:
Link Items
You can use the Links API to add global links.
They are displayed on all Fumadocs UI layouts (e.g. Home Layout and Docs Layout). Links items are passed to the layout.
GitHub Url
A shortcut for adding GitHub repository link item.
Navbar
A part of all Fumadocs UI layouts, it displays the link items and your logo.
For the full options, see Navbar.
Sidebar
A part of Docs Layout, it displays the complete structure of page tree.
Besides the page tree, the sidebar exposes a banner
and footer
option.
You can use them to add additional components.
For example, adding an announcement as the banner of sidebar:
Docs Page
A documentation page, with Docs Page Layout.
Table Of Contents
It displays the headings of document.
Generally, toc
is generated from the Markdown/MDX content (usually supplied by the content source, or using a Remark plugin).
You may modify the data passed to toc
.
It exposes a banner
and footer
option, use it to add additional components about the page.
Popover Mode
On smaller devices, it is shown as a popover (dropdown) component. You can also customise it with the exposed props aforementioned.
To display the same banner/footer on both modes, pass them individually.
Breadcrumbs
It displays the path to the active node of page tree.
For example, when opening page A, the breadcrumbs should display folder > a
.
By default, meaningless parts like the page tree root are omitted. You can customise its behaviour with the exposed options.
For the full options, see Breadcrumbs.
Page Footer
It displays two buttons to jump to the next and previous pages.
By default, it selects the neighbour nodes of the active node in page tree. You can specify the items of footer.
Others
Document Search
Search is also an important way to navigate between pages, you can refer to Search to learn more about configuring document search.
Hierarchy
Hierarchy can create an intuition to users, Fumadocs UI is designed in:
-
Links API adds links to the layout, they should redirect the user to another layout, like the blog page or landing page.
-
A page tree can have multiple roots, each root contains a tree of navigation links. Users can switch between roots from sidebar.
-
The active page tree will be shown on navigation elements like sidebar, allowing users to switch between pages.
-
The page shows its content, with elements like Table of Contents to improve the reading experience.
Nodes should not impact their upper nodes (ancestors). For example, clicking a page tree item on sidebar should not change the root of page tree.
Changing Routes
The default routing structure of your docs can also be changed as it is essentially a Next.js app.
Remove the docs layout of a certain page
The /docs/[[...slug]]
route is a catch-all route.
To use another layout for a certain page, move the page outside the app/docs
folder, to a place that's accessible with the same base route /docs
.
This is possible using Next.js Route Group. For example, adding a /docs
page without docs layout.
Ensure there's no duplicated page with the same URL in the catch-all route [[...slug]]/page.tsx
.
In the above example, a MDX file with the path content/docs/index.mdx
will produce errors.
FAQ
Multi versions
Use a separate deployment for each version.
On Vercel, this can be done by creating another branch for a specific version on your GitHub repository. To link to the sites of other versions, use the Links API or a custom navigation component.
Multi Docs
See Multiple Page Trees.
Last updated on