App sidebar
The real thing: a team switcher in the header, a group with a collapsible sub-menu, projects with per-row actions and a count, and the account menu in the footer. The current page has the highlighter and the bracket in the margin. Try Ctrl/Cmd+B.
Collapse to icons
collapsible="icon" shrinks the pad to a 3rem strip: labels fade, the margin bracket steps aside, the binder clip comes off, and each button names itself in a tooltip. The state is controlled here so the page can read it.
Variants and sides
sidebar docks to the edge and casts its shadow toward the page; floating is set down on the desk and turned a little; inset leaves a margin and makes the page itself a sheet of paper. Either side of the screen works, and the clip and torn edge follow.
Search and loading
A long menu stays cheap: 40 notebooks are 40 list items with no drawing each, only the current one draws its mark. The search field filters them, the plus on the label adds one, and Reload shows loading rows (their widths come from a seed, so they are the same on the server and the client).
Demo
Official `sidebar-demo`: one group of five links and an inset with the trigger. The pad hangs from a binder clip and every link wears the highlighter when pointed at. The outer frame is only there so the fixed pad stays inside this preview (in an app the provider goes at the root); try Ctrl/Cmd+B.
Header and footer
Official `sidebar-header` and `sidebar-footer` in one pad: a workspace switcher on top whose menu opens downward at the width of its button, and an account menu at the bottom that opens upward (`side="top"`). While a menu is open its button keeps the highlighter, where shadcn tints it with the accent color.
Group
Official `sidebar-group`: a `SidebarGroup` is a label (a typewriter kicker) over a menu. Two buttons here; a pad can hold as many groups as it likes. Like the original, this one has no inset page beside it.
Collapsible group
Official `sidebar-group-collapsible`: the group label becomes the trigger of a Collapsible (`SidebarGroupLabel asChild` around `CollapsibleTrigger`), with a chevron that turns over as it opens. The label wears the highlighter on hover, where shadcn tints it with the accent color.
Group action
Official `sidebar-group-action`: a `SidebarGroupAction` is a small button in the corner of a group, next to its label. Here the plus posts a toast. The original parks the Toaster at the bottom left with a margin to clear the sidebar; inside this frame it sits at the bottom right instead.
Menu
Official `sidebar-menu`: five projects as `SidebarMenuButton asChild` around links. Each row carries its own line of the pad's ruling, painted by CSS, so this list costs no drawing per row; only a current page (`isActive`) draws a mark.
Menu action and badge
Official `sidebar-menu-action` and `sidebar-menu-badge` in one pad. Top group: each row has a `SidebarMenuAction` (a small button that opens a menu), and the row keeps the highlighter while its menu is open. Bottom group: a `SidebarMenuBadge` writes a count in the margin in blue felt tip. Action and badge share the same corner, so a row takes one or the other.
Menu sub
Official `sidebar-menu-sub`: a table of contents, each section a button over an indented `SidebarMenuSub` that is always open. A pencil line runs down the start of each sub-list. The content scrolls inside the pad when it is taller than the pad. The data is the original's, written as strings.
Menu collapsible
Official `sidebar-menu-collapsible`: the same table of contents with each section folding open and shut. The first section starts open. The original wraps each item in a `div`, which is not valid inside a `ul`; `Collapsible asChild` here lets the `li` itself be the collapsible, so the list markup stays valid and the chevron still turns from `group-data-[state=open]/collapsible`.
Controlled and loading
Official `sidebar-controlled` and `sidebar-rsc` in one pad. Controlled: `open` and `onOpenChange` on the provider, with the state kept in the page so any button can open and close the pad. Loading: `SidebarMenuSkeleton` rows (with icons) stand in while the projects load, then are swapped for the list. The original's loading is a React Server Component behind Suspense, which a client-only page cannot show, so a timer stands in for the fetch. Reload runs it again.