Skip to content

Sidebar

Free

A composable app sidebar: a fixed panel that slides out or shrinks to an icon rail on desktop, and a Drawer on phones.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Wrap the Sidebar and the SidebarInset in a SidebarProvider. The provider holds the open state, the cookie, and the keyboard shortcut.

app-shell.tsx

Sidebar

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

SidebarTrigger

<button>
PropTypeDefaultDescription
glass"clear""dark""light"—
rounded"default""full"—
size"default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs"—
variant"dashed""default""destructive""destructive-outline""ghost""link""media""outline""secondary"—
classNamestring—
busyboolean—The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading.
spinnerPlacement"center""start"—center (default): the spinner covers the label. start: it takes the leading icon slot. The icon sizes always use center, because their one icon is the label.
From Base UIButtonBase UI docs
focusableWhenDisabledbooleanfalseWhether the button should be focusable when disabled.
render—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.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

SidebarMenuButton

<button>
PropTypeDefaultDescription
size"default""lg""sm""default"
variant"default""outline""default"
isActivebooleanfalseThe current page: the raised chip and data-active. Also set aria-current="page" on a link.
tooltip—The row tooltip: a string, or the TooltipContent props. It shows at once (no delay), in the one tooltip that glides between rows: on the icon rail always, in the open panel only while the label is cut off.
From Base UIUseRenderBase UI docs
render—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.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

SidebarMenuSkeleton

<div>
PropTypeDefaultDescription
showIconbooleanfalseShow a 16px square in the icon place.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

SidebarMenuSubButton

<a>
PropTypeDefaultDescription
size"md""sm""md"md (default) 28px, sm 24px. Text is 14px in both.
isActivebooleanfalseThe current page: the raised chip. Also set aria-current="page".
tooltip—The full label, shown in the row tooltip while the row cuts it off.
From Base UIUseRenderBase UI docs
render—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.
...props<a> attributes—Every other attribute goes to the <a>, with a ref.
  • Use it for the main navigation of an app, with groups, rows, and child pages.
  • Use collapsible="icon" to keep a 48px icon rail. Use offcanvas to slide the panel out, or none to keep it open.
  • Use variant to set the look: sidebar, floating, or inset.
  • Use side="right" for a details panel at the inline end.
  • Use contained for a Sidebar inside a block of a page, not on the screen edge.
  • For the main views of a phone app, use a Thumb Bar.
  • For a short panel that opens over the page, use a Drawer.
  • For a list of actions that opens from a button, use a Menu.
⌘BorCtrlBOpens or closes the Sidebar. keyboardShortcut changes the letter.
EnterorSpaceOn SidebarTrigger: opens or closes the Sidebar.
EscapePhone Drawer: closes the Drawer.

SidebarTrigger is a button that controls the panel, and Ctrl+B or ⌘B toggles it. Its tooltip shows the keys, and aria-keyshortcuts names them.

Under 768px the panel is a Drawer, so it traps focus and Escape closes it.

In collapsible="icon" the label is gone. Give each SidebarMenuButton a tooltip.

Fold
sheet · 300ms · ease-panel (0.2, 0.4, 0.2, 1) · slides with `transform`; the page takes its room at once

Built with

Installs with Sidebar

  1. AddedSidebar, with Button, Drawer, Input, Kbd, Separator, Skeleton, Tooltip.
Open the release