Page Tree
The page tree is the core data structure for navigation:Sidebar Setup
Basic Sidebar
app/docs/layout.tsx
Sidebar Provider
For custom implementations:Sidebar Components
Sidebar Items
Folder Without Index
For folders without an index page, use trigger:Page Tree Renderer
Automatically render sidebar from page tree:Custom Renderers
Customize how nodes are rendered:Sidebar State
useSidebar Hook
useFolder Hook
Access folder state within a folder:Sidebar Tabs
Organize documentation into tabs:Custom Tab Transform
Responsive Behavior
Mobile Drawer
On mobile (< 768px), sidebar becomes a drawer:
Collapsible Sidebar
Collapse sidebar on desktop:Sidebar Content
Handle collapsed state:Sidebar Viewport
Scrollable area for sidebar content:Active State
Sidebar items automatically detect active state:Auto Scroll
Active items automatically scroll into view:External Links
Mark external links:<a> instead of Next.js <Link> and show an icon.
Folder Depth
Get current folder nesting level:Close on Redirect
Control sidebar behavior on navigation:Best Practices
- Root Folders: Use
root: truefor top-level sections to enable tabs - Default Open: Set
defaultOpenLevelbased on your content depth - Collapsible: Make deep folders collapsible for better UX
- Icons: Add icons to folders and items for visual hierarchy
- Index Pages: Provide index pages for folders when possible
- Separators: Use separators to group related content
- Active State: Trust automatic active detection instead of manual state
- Prefetch: Enable prefetch for faster navigation