Sidebar

The application's left navigation rail, collapsible and persistent.

Dashboard
<Sidebar.Provider>
	<Sidebar.Root collapsible="icon">
		<Sidebar.Header>…</Sidebar.Header>
		<Sidebar.Content>
			<Sidebar.Group>
				<Sidebar.GroupLabel>Platform</Sidebar.GroupLabel>
				<Sidebar.GroupContent>
					<Sidebar.Menu>
						<Sidebar.MenuItem>
							<Sidebar.MenuButton isActive tooltip="Dashboard">
								<HouseIcon />
								<span>Dashboard</span>
							</Sidebar.MenuButton>
						</Sidebar.MenuItem>
					</Sidebar.Menu>
				</Sidebar.GroupContent>
			</Sidebar.Group>
		</Sidebar.Content>
	</Sidebar.Root>
	<Sidebar.Inset>
		<header><Sidebar.Trigger /></header>
	</Sidebar.Inset>
</Sidebar.Provider>

collapsible takes offcanvas (slides away), icon (collapses to a rail of icons) or none. With icon, the tooltip on each menu button is what labels it once the text is hidden, so pass it always.

The provider stores the open state in a cookie, so the sidebar comes back the way the user left it.

API

Sidebar.Root

PropTypeDefault
collapsible"icon" | "none" | "offcanvas""offcanvas"
sheetDescriptionstring"Displays the mobile sidebar."
sheetTitlestring"Sidebar"
side"left" | "right""left"
variant"floating" | "inset" | "sidebar""sidebar"

Plus every <div> prop. Source: sidebar/components/sidebar-root.tsx.

Sidebar.Content

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <div> prop. Source: sidebar/components/sidebar-content.tsx.

Sidebar.Footer

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <div> prop. Source: sidebar/components/sidebar-footer.tsx.

Sidebar.Group

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <div> prop. Source: sidebar/components/sidebar-group.tsx.

Sidebar.GroupAction

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <button> prop. Source: sidebar/components/sidebar-group-action.tsx.

Sidebar.GroupContent

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <div> prop. Source: sidebar/components/sidebar-group-content.tsx.

Sidebar.GroupLabel

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <div> prop. Source: sidebar/components/sidebar-group-label.tsx.

Sidebar.Header

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <div> prop. Source: sidebar/components/sidebar-header.tsx.

Sidebar.Input

PropTypeDefault
classNamestring | ((state: InputState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
defaultValuestring | number | readonly string[]The default value of the input. Use when uncontrolled.
onValueChange((value: string, eventDetails: { reason: "none"; event: Event; cancel: () => void; allowPropagation: () => void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element | undefined; }) => void)Callback fired when the value changes. Use when controlled.
renderComponentRenderFn<HTMLProps, InputState> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
styleCSSProperties | ((state: InputState) => CSSProperties | undefined)Style applied to the element, or a function that returns a style object based on the component's state.
valuestring | number | readonly string[]The value of the input. Use when controlled.

Plus the DOM props of the element it renders. Source: sidebar/components/sidebar-input.tsx.

Sidebar.Inset

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <main> prop. Source: sidebar/components/sidebar-inset.tsx.

Sidebar.Menu

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <ul> prop. Source: sidebar/components/sidebar-menu.tsx.

Sidebar.MenuAction

PropTypeDefault
showOnHoverbooleanfalse
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <button> prop. Source: sidebar/components/sidebar-menu-action.tsx.

Sidebar.MenuBadge

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <div> prop. Source: sidebar/components/sidebar-menu-badge.tsx.

Sidebar.MenuButton

PropTypeDefault
isActivebooleanfalse
size"default" | "lg" | "sm""default"Row height. sm for a dense secondary list, lg for a top-level entry with a description.
tooltipstring | Props
variant"default" | "outline""default"outline gives the item its own border, for a button that is not part of the navigation list.
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <button> prop. Source: sidebar/components/sidebar-menu-button.tsx.

Sidebar.MenuItem

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <li> prop. Source: sidebar/components/sidebar-menu-item.tsx.

Sidebar.MenuSkeleton

PropTypeDefault
showIconbooleanfalse

Plus every <div> prop. Source: sidebar/components/sidebar-menu-skeleton.tsx.

Sidebar.MenuSub

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <ul> prop. Source: sidebar/components/sidebar-menu-sub.tsx.

Sidebar.MenuSubButton

PropTypeDefault
isActivebooleanfalse
size"default" | "sm""default"
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <a> prop. Source: sidebar/components/sidebar-menu-sub-button.tsx.

Sidebar.MenuSubItem

PropTypeDefault
renderComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.

Plus every <li> prop. Source: sidebar/components/sidebar-menu-sub-item.tsx.

Sidebar.Provider

PropTypeDefault
defaultOpenbooleantrue
keyboardShortcutstring | falseSIDEBAR_KEYBOARD_SHORTCUT
onOpenChange((open: boolean) => void)
openboolean

Plus every <div> prop. Source: sidebar/components/sidebar-provider.tsx.

Sidebar.Rail

Plus every <button> prop. Source: sidebar/components/sidebar-rail.tsx.

Sidebar.Separator

PropTypeDefault
classNamestring | ((state: SeparatorState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
orientationOrientationThe orientation of the separator.
renderComponentRenderFn<HTMLProps, SeparatorState> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
styleCSSProperties | ((state: SeparatorState) => CSSProperties | undefined)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: sidebar/components/sidebar-separator.tsx.

Sidebar.Trigger

PropTypeDefault
loadingbooleanShow a leading spinner and mark the button aria-busy, disabling interaction while an async action is in flight (e.g. a form submit).
shape"default" | "pill"pill forces a fully rounded button; default follows the theme's --radius, so it changes with the brand.
size"default" | "icon" | "icon-lg" | "icon-sm" | "icon-xs" | "lg" | "sm" | "xs"Height and horizontal padding. The icon-* set is square, for a button whose entire content is one icon — give those an aria-label.
variant"brand" | "default" | "destructive" | "ghost" | "highlight" | "link" | "outline" | "primary" | "secondary"Weight of the action. default is the one thing the page exists for, at most one per view; secondary an equal-weight alternative; outline for toolbars and anything that repeats in a row; ghost inside dense surfaces; destructive for what cannot be undone; link for an action that reads as navigation.
classNamestring | ((state: ButtonState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
focusableWhenDisabledbooleanWhether the button should be focusable when disabled.
nativeButtonbooleanWhether the component renders a native <button> element when replacing it via the render prop. Set to false if the rendered element is not a button (for example, <div>).
renderComponentRenderFn<HTMLProps, ButtonState> | ReactElement<unknown, string | JSXElementConstructor<any>>Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
styleCSSProperties | ((state: ButtonState) => CSSProperties | undefined)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: sidebar/components/sidebar-trigger.tsx.