Docs Layout
The layout of documentation
The layout of documentation pages, it includes a sidebar and navbar.
It is a server component, you should not reference it in a client component.
Usage
Pass your page tree to the component.
Sidebar
Provide elements to navigate between pages.
Sidebar Tabs
Add a navigation component to switch between root folders (Enabled by default). You can add items from the page tree (see Root Folder).
Good to know
You can also use Root Toggle component.
Disable Tabs
Add Description
Add description
to the meta file of root folder.
Decoration
Change the icon/styles of tabs.
Disable Prefetching
By default, it uses the Next.js Link component with prefetch enabled. When the link component appears into the browser viewport, the content (RSC payload) will be lazy loaded.
Unless you put most of the page items in folders, all page items on the sidebar will be lazy loaded. On Vercel, this may cause a high usage of serverless functions and Data Cache. It can also hit the limits of some other hosting platforms.
You can disable prefetching to reduce the amount of RSC requests.
Disable Sidebar from Pages
This is not supported. Due to the limitations of App Router, layouts are not re-rendered when navigating between pages. It is an anti-pattern to change your layout from a page.
You can consider:
- Disable sidebar from the entire layout.
- Create a MDX Page in a layout that doesn't contain a sidebar.
Reference
Prop | Type | Default |
---|---|---|
enabled | boolean | - |
component | ReactNode | - |
collapsible | boolean | - |
tabs | false | Option[] | TabOptions | - |
defaultOpenLevel | number | 0 |
prefetch | boolean | true |
components | Partial<Components> | - |
banner | ReactNode | - |
footer | ReactNode | - |
hideSearch | boolean | false |
Last updated on