Sidebar

Composable primary navigation with provider state, collapse modes, and a List Item menu hierarchy.

Also known as: app sidebar, navigation sidebar, vertical nav, primary nav, side navigation, labeled nav, app shell nav

Installation

Install with the CLI, or copy the component source into your project.

Add sidebar (npm)

npx --yes -p @default-file/ui df-ui add sidebar

Default

Docked primary navigation with List Item rows, icon collapse, and separators between groups.

Default FileStudio
Studio

Scrollbar types

thumb and edge scrollbar styles. visibility hover shows the bar only while the panel is hovered.

thumb

Default FileStudio
Studio

edge

Default FileStudio
Studio

Icon collapsed

Icon collapse shrinks the panel to icon width. SidebarMenuItem tooltip shows labels while collapsed.

Default FileStudio
Studio

Floating

Rounded floating panel with border and elevation.

Default FileStudio
Studio

Inset

Inset panel with margin, radius, and elevation on SidebarInset.

Default FileStudio
Studio

Offcanvas

Slides the panel off the edge. In frame layout the seam cannot reopen while collapsed, so keep a SidebarTrigger in SidebarInset.

Default FileStudio
Studio
Workspace

Search background

Override the SidebarInput fill with background.

Default FileStudio
Studio

Nested menu

Hover a List Item to open Option List beside the panel. Use width fill and OptionListSubmenu for nested levels.

Default FileStudio
Studio

Properties

Composable primary navigation. SidebarProvider owns open state, height, and collapse defaults. Compose header, scrollable content, and footer with List Item rows.

useSidebar

Context hook. Throws when used outside SidebarProvider.

PropTypeDefaultNotes
state"expanded" | "collapsed"-Desktop expand state.
openboolean-Desktop expanded when true.
setOpen(open: boolean | ((value: boolean) => boolean)) => void-Set desktop open state.
openMobileboolean-Mobile overlay open state.
setOpenMobile(open: boolean) => void-Set mobile overlay open state.
isMobileboolean-True when the mobile breakpoint is active.
toggleSidebar() => void-Toggle desktop open or mobile overlay.
side"left" | "right"-Provider default edge.
variant"docked" | "floating" | "inset"-Provider default appearance.
collapsible"offcanvas" | "icon" | "none"-Provider default collapse mode.
edgeCollapseboolean-Provider default for the seam toggle.
edgeBorderboolean-Provider default for the seam hover accent.
layout"app" | "frame"-Provider layout mode.
fillHeightboolean-Provider fillHeight prop value.
heightMode"fill" | "fixed" | "auto"-Resolved height mode from height and fillHeight.
labelstring-Accessible name for toggles and the mobile panel.
hostRefRefObject<HTMLDivElement | null>-Ref to the SidebarProvider host element.