Sidebar
v0.64.0, changelogBetaA console's main navigation: grouped links with counts, tags and nested pages, a switcher header and an account footer, collapsing to an icon rail (⌘B / Ctrl+B) and a sheet on phones.
Running missions
Your page
Expanded
Install
npx shadcn add @syncrobotic/sidebar Also installs: radix-ui@^1, lucide-react@^1, @syncrobotic/cn, @syncrobotic/badge, @syncrobotic/sheet, @syncrobotic/tooltip, @syncrobotic/use-hotkeys, @syncrobotic/use-now
Overview
When to use
- The sections of an internal tool or a fleet console, on a laptop or a control-room screen.
- Switching between sites, workspaces or robots, in its header, above the sections they share.
- A section with a few pages of its own, listed under it while it is current.
Use something else
- The whole frame (sidebar, top bar with title, search and environment, content and footer): the
app-shellblock, built on this. - A website's header with a few areas: Navigation menu.
- Up to four sections of a phone app, in thumb reach: the
app-shell-mobile-tabsblock. - A hierarchy from data (sites › zones › robots): Tree.
- Sections of one page: Tabs or Scrollspy.
More examples
States and real uses. Each example is also a Storybook story and a visual regression test.
Collapsed
Single trigger
Mobile
Usage rules
- For an app's sections: the main navigation of a console. Pages of one section go under it (SidebarMenuSub), shown while the section is current; never more than two levels.
- Current page: isActive, the kit's muted fill and weight. Hover is the lighter accent. Never a colour, never a bar beside the item.
- Counts are SidebarMenuBadge: danger only for what needs someone (unacknowledged alarms), neutral for the rest. Tags ("Beta", "New") are SidebarMenuTag, small grey words.
- Every item leads with an icon and has a tooltip: collapsed, the rail shows only the icons. Group names give way to a short line.
- A switcher for sites, workspaces or robots goes in SidebarHeader as a size="lg" button that opens a menu; the account goes in SidebarFooter the same way.
- Open by default on wide screens, a rail below about 1280 px. People choose with the trigger or ⌘B / Ctrl+B, and the cookie keeps it.
- Collapse and width belong to the sidebar's edge: SidebarRail, a window splitter shown while the pointer is over the sidebar. Drag to resize (200 to 320 px; under 140 it folds to the rail), click or Enter to collapse and expand, ← and → from the keyboard.
- Beside a floating sidebar it sits in the gap; never a top-bar control on wide screens. On phones the sidebar is a sheet opened by SidebarTrigger show="mobile" in the top bar.
Changelog
- 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.
- 0.63.22026-12-01The script that restores the rail from the cookie escapes the cookie name, so a name with </script> or a line separator cannot end the script early.
- 0.53.02026-11-27Its doc opens with its description, word for word; the code is unchanged.