Sidebar
Render a Fumadocs page tree with the shadcn/ui sidebar.
Installation
Usage
DocsLayout renders the sidebar for you. Use SidebarPageTree directly to build your own layout on the shadcn/ui sidebar. It reads the page tree from TreeContextProvider (tree context):
Top-level separators become SidebarGroup labels. Pages render as SidebarMenuButton links, and folders as collapsible SidebarMenuSub lists that open when the current page is inside them. A folder with an index page links to it and has a separate button to expand it. The active page is scrolled into view, and the mobile sheet closes after navigating.
SidebarPageTree accepts Item, Folder and Separator components to replace how each kind of node renders. Wrap it in SidebarTreeOptionsProvider to set defaultOpenLevel and prefetch.
SidebarLinkItem (in components/sidebar/link-item) renders a layout link (LinkItemType) the same way.