- Components
- Navigation
Sidebar
shadcn's composable sidebar on Base UI. A grey panel with muted rows, a sliding hover pill and a resting active pill, icon collapse with tooltips, sub-menus on Collapsible, and a Sheet on mobile. Inputs and secondary buttons inside switch to the raised look.
Installation#
npx shadcn add @ortaui/sidebarExamples#
Icon-collapsible: toggle with the trigger, the rail or Cmd/Ctrl+B#
Floating, offcanvas, right side#
Inset, icon#
Mobile sheet (forced here; follows the viewport by default)#
Loading rows#
API reference#
| Prop | Type | Default | Description |
|---|---|---|---|
| SidebarProvider: defaultOpen / open / onOpenChange | boolean / boolean / (open) => void | true | Expanded state, uncontrolled or controlled. Writes the sidebar_state cookie; Cmd/Ctrl+B toggles. |
| SidebarProvider: mobile | boolean | viewport < md | Force the mobile sheet (true) instead of following the viewport. Added for previews and container layouts. |
| Sidebar: side | "left" | "right" | "left" | Edge the sidebar sits on. |
| Sidebar: variant | "sidebar" | "floating" | "inset" | "sidebar" | Docked with a border, a floating rounded-3xl panel, or inset (pair with SidebarInset for a rounded page panel). |
| Sidebar: collapsible | "offcanvas" | "icon" | "none" | "offcanvas" | Slide out of view, collapse to a 56px icon rail (tooltips appear), or never collapse. |
| SidebarMenu | ul | - | Owns two sliding pills: one follows hover and keyboard focus, one rests on the item with data-active. They also cover SidebarMenuSub items. |
| SidebarMenuButton: isActive | boolean | false | Marks the active item (data-active) and moves the resting pill there. |
| SidebarMenuButton: variant / size | "default" | "outline" / "default" | "sm" | "lg" | "default" / "default" | 40px rows by default; sm is 32px, lg is 48px. |
| SidebarMenuButton: tooltip | string | TooltipContent props | - | Tooltip shown on the right while icon-collapsed. |
| SidebarMenuAction: showOnHover | boolean | false | Reveal the action on hover or focus of the row. |
| SidebarMenuSkeleton: showIcon | boolean | false | Loading row; the width is stable between server and client. |
| SidebarMenuSubButton: size / isActive | "sm" | "md" / boolean | "md" / false | Row inside SidebarMenuSub, usually under a Collapsible. |
| render | ReactElement | - | On menu buttons, actions, group parts: render as your own element, e.g. a Next link. |
| useSidebar() | () => { state, open, setOpen, openMobile, setOpenMobile, isMobile, toggleSidebar } | - | Read and drive the sidebar from anywhere inside the provider. |