ortaui
  1. Components
  2. 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/sidebar

Examples#

Icon-collapsible: toggle with the trigger, the rail or Cmd/Ctrl+B#

Dashboard

Floating, offcanvas, right side#

Floating

Inset, icon#

Inset

Mobile sheet (forced here; follows the viewport by default)#

Mobile

Loading rows#

Loading

API reference#

PropTypeDefaultDescription
SidebarProvider: defaultOpen / open / onOpenChangeboolean / boolean / (open) => voidtrueExpanded state, uncontrolled or controlled. Writes the sidebar_state cookie; Cmd/Ctrl+B toggles.
SidebarProvider: mobilebooleanviewport < mdForce 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.
SidebarMenuul-Owns two sliding pills: one follows hover and keyboard focus, one rests on the item with data-active. They also cover SidebarMenuSub items.
SidebarMenuButton: isActivebooleanfalseMarks 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: tooltipstring | TooltipContent props-Tooltip shown on the right while icon-collapsed.
SidebarMenuAction: showOnHoverbooleanfalseReveal the action on hover or focus of the row.
SidebarMenuSkeleton: showIconbooleanfalseLoading row; the width is stable between server and client.
SidebarMenuSubButton: size / isActive"sm" | "md" / boolean"md" / falseRow inside SidebarMenuSub, usually under a Collapsible.
renderReactElement-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.