Layout
The layout of documentation
The layout of documentation pages, it includes 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.
Non-docs Layout
To share the navbar and search dialog across other pages, use the Layout
component.
It doesn't contain a sidebar, therefore, a page tree is not required.
Create a Route Group to share the same layout across multiple pages.
Navbar
The navigation header provides common interactive elements.
Prop | Type | Default |
---|---|---|
enabled | boolean | - |
component | ReactNode | - |
githubUrl | string | - |
title | ReactNode | - |
children | ReactNode | - |
url | string | '/' |
enableSearch | boolean | - |
transparentMode | "always" | "top" | "none" | none |
Sidebar
Provide elements to navigate between pages.
Prop | Type | Default |
---|---|---|
enabled | boolean | - |
component | ReactNode | - |
collapsible | boolean | - |
footer | ReactNode | - |
defaultOpenLevel | number | 1 |
components | Partial<Components> | - |
banner | ReactNode | - |
Disable Sidebar from Pages
A simple answer is No.
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 (e.g. non-docs layout).
Links
Navigation links displayed on every page.
Item
A link to navigate to an URL, can be external.
To mark the item as active when browsing child pages like /blog/post
, add set it as nested-url
.
Secondary Item
Same as normal items, but are shown as icon buttons on the navbar.
Dropdown Menu
A dropdown menu containing multiple link items.
Last updated on