# Sidebar shell

A wide sidebar with icon navigation, sections and the user at the bottom.

Import from `@a31labs/rax/sidebar-shell`.

## Usage

```tsx
<SidebarShell
  brand={<Menu trigger={<AppButton />} items={[{ label: "Operations", description: "Routes, vehicles and drivers", icon: <Truck />, current: true, onSelect }]} />}
  brandMark={<Logo />}
  subtitle="Operations"
  collapsible
  nav={[
    { items: [
      { label: "Overview", href: "/", icon: <LayoutDashboard />, current: true },
      { label: "Routes", href: "/routes", icon: <Route />, children: [{ label: "Planned", href: "/routes/planned" }] },
    ] },
    { label: "Reports", items: [{ label: "Notifications", href: "/notifications", icon: <Bell />, badge: "5" }] },
  ]}
  footer={<UserCard />}
  collapsedFooter={<Avatar name="Mara Okafor" />}
  renderLink={(p) => <NextLink {...p} />}
>
  {children}
</SidebarShell>
```

## Rules

Props: `brand`, `subtitle` (the current area under the brand), `switcher` (beside the brand, e.g. a Menu that switches areas), `nav` (groups of `{ label, href, icon, current, badge, attrs, children }`, a group may have a `label`), `footer` (pinned to the bottom: the signed-in user, sign out), `actions` (right side of the mobile bar), children, `renderLink`, `collapsible` with `collapsed`, `defaultCollapsed`, `onCollapsedChange`, `brandMark` and `collapsedFooter`, `topbar` (a 56px bar across the page above the sidebar for context pickers, a page path and actions; `brand` is then optional) and `navStart` (above the groups, e.g. a link back to the parent level). A group with `collapsible` turns its label into a toggle (`aria-expanded`) with a chevron. A 260px sidebar on surface with a `line` edge, sticky at full height; the main area gets 32px 40px padding. Items are `h-ctl` high with a 20px icon, 12px gap, ink-2 text; hover surface-2. The current page has a surface-2 fill, weight 600, a 3px accent bar on the left edge and its icon in the accent. Items with `children` get a chevron toggle (`aria-expanded`) and open by themselves when one of their pages is current; sub-pages are indented and smaller. With `collapsible`, a "Collapse sidebar" row above the footer narrows the sidebar to 72px of icons: labels and badges stay in the accessible name and show as a title on hover, group labels become a divider, sub-pages hide, and `brandMark` and `collapsedFooter` replace the brand and footer. Below 1024px the sidebar becomes a 56px top bar with a menu button that opens the same navigation in a left Drawer; following a link closes it. Set `--rax-shell-top` when something sticky sits above the shell.

Page: https://rax.a31.at/components/sidebar-shell
