---
title: Sidebar
description: Build desktop sidebar navigation that moves into a mobile drawer.
package: moraine
version: 0.11.0
repository: https://github.com/subframe7536/moraine
---

# Sidebar

> Build desktop sidebar navigation that moves into a mobile drawer.

## Anatomy

```text
Sidebar [component; slot=root]
├── Sidebar.Panel [part; slot=panel]
│   ├── Sidebar.Header [part; slot=header]
│   ├── Sidebar.Content [part; slot=content]
│   │   └── Sidebar.Group [part; slot=group]
│   │       ├── Sidebar.GroupLabel [part; slot=groupLabel]
│   │       └── Sidebar.Menu [part; slot=menu]
│   │           └── Sidebar.MenuItem [part; slot=menuItem]
│   │               ├── Sidebar.MenuButton [part; slot=menuButton]
│   │               │   ├── menuButtonLeading [slot]
│   │               │   ├── menuButtonLabel [slot]
│   │               │   └── menuButtonTrailing [slot]
│   │               ├── Sidebar.MenuAction [part; slot=menuAction]
│   │               └── Sidebar.MenuSub [part; slot=menuSub]
│   │                   ├── Sidebar.MenuSubTrigger [part; slot=menuSubTrigger]
│   │                   └── Sidebar.MenuSubContent [part; slot=menuSubContent]
│   │                       └── Sidebar.MenuItem [part; slot=menuItem]
│   └── Sidebar.Footer [part; slot=footer]
├── Sidebar.Rail [part; slot=rail]
├── Sidebar.Inset [part; slot=inset]
└── Sidebar.Trigger [part]
```

`Sidebar.Trigger` can appear anywhere inside the root, and `Sidebar.Rail` sits directly between `Panel` and `Inset`. On mobile, `Sidebar.Panel` renders its regions inside an internal Drawer. `Sidebar.Inset` renders a `<main>` landmark by default, so keep page content inside it instead of adding another `<main>`.

## Usage

Use Sidebar for application-shell navigation that stays inline on desktop and moves into a
mobile drawer. Use [Drawer](https://moraine.subf.dev/components/drawer.md) for a standalone swipe-to-dismiss drawer that is not a persistent
layout region. Use [NavigationMenu](https://moraine.subf.dev/components/navigation-menu.md) for a website header of links and
panels.

`Sidebar` is both the state provider and the desktop layout root. `Sidebar.Panel` renders inline on
desktop and moves the same content into a mobile Drawer on smaller viewports.

```tsx
import { Sidebar } from 'moraine'

export function Example() {
  return (
    <Sidebar>
      <Sidebar.Panel>
        <Sidebar.Content>
          <Sidebar.Group>
            <Sidebar.GroupLabel>Navigation</Sidebar.GroupLabel>
            <Sidebar.Menu>
              <Sidebar.MenuItem>
                <Sidebar.MenuButton leading="i-lucide:home" active>
                  Home
                </Sidebar.MenuButton>
              </Sidebar.MenuItem>
              <Sidebar.MenuItem>
                <Sidebar.MenuButton leading="i-lucide:settings">Settings</Sidebar.MenuButton>
              </Sidebar.MenuItem>
            </Sidebar.Menu>
          </Sidebar.Group>
        </Sidebar.Content>
      </Sidebar.Panel>
      <Sidebar.Inset>Content</Sidebar.Inset>
    </Sidebar>
  )
}
```

### Responsive navigation ownership

Keep one navigation tree inside `Sidebar.Panel`. Put the application header outside the
frame, then place `Sidebar.Trigger` where users need to reveal or collapse navigation. A child that
must coordinate with the sidebar reads `Sidebar.useContext()` instead of keeping a second open
state.

```tsx
<Sidebar.Trigger as={Button} variant="ghost" size="icon-sm" aria-label="Toggle sidebar">
  Open
</Sidebar.Trigger>
```

Root `open`, `defaultOpen`, and `onOpenChange` drive whichever layout is active: the desktop panel or
the mobile drawer. Uncontrolled desktop and mobile states are remembered separately. `defaultOpen`
seeds both layouts, `defaultOpen="desktop-only"` seeds only the panel, and when omitted the desktop
panel starts expanded and the drawer starts closed. Switching layouts never calls `onOpenChange` and
never writes a controlled `open`. Leaving mobile closes an uncontrolled drawer, and returning to
desktop restores the desktop state. The trigger, the rail, and Escape or overlay dismissal of the
drawer all report through `onOpenChange`.

On mobile, a `Sidebar.MenuButton` with `href` closes the drawer when activated. Modified and
non-primary clicks, and clicks that call `preventDefault()`, leave it open. Set
`closeOnSelect={false}` to keep the drawer open after an `href` click, or `closeOnSelect` on a
button without `href` to close it.

When `mobile` is omitted, `breakpoint` (default `768`) selects the layout through the
`(max-width: ${breakpoint}px)` media query, and the server renders the desktop layout. Pass `mobile`
to force either layout.

`side` (`'left'` or `'right'`) and `variant` (`'default'`, `'floating'`, or `'inset'`) on the root
choose the viewport edge and chrome. Root `classes` and `styles` set defaults for the slots of every
part. On mobile, the sidebar renders inside a Drawer. Style the Sidebar regions through their own
slots; Sidebar overrides do not style the internal Drawer. See [Theming](https://moraine.subf.dev/docs/theming.md) for
nested Provider behavior.

`Sidebar` declares `--mo-sidebar-width` on its root. Pass a numeric `width` (controlled),
`defaultWidth` (uncontrolled), `minWidth` (default `224`), or `maxWidth` (default `480`) in pixels.
`onWidthChange` reports every width change. When none of the width props is set, the recipe fallback
`var(--sidebar-width, clamp(14rem, 25%, 20rem))` applies, so you can also set the global
`--sidebar-width` in CSS or with `presetMoraine`. When collapsed, the desktop panel keeps its width
and slides out with a negative margin, so its content does not reflow during the transition.

The root uses `h-full` so it can sit inside a bounded container. For a viewport shell, pass
`class="h-dvh"` (or `h-svh`) on the root.

Call `Sidebar.useContext()` from a descendant for `side`, `variant`, `isMobile`, `isOpen`, `state`
(`'expanded'` or `'collapsed'`), `setOpen`, and `toggle`. Place a global application header outside
the frame. Pass `translations` (`label` for the mobile drawer, `resize` for the rail) to localize
the accessible names of one sidebar.

### Resizable rail

Place `Sidebar.Rail` directly between `Sidebar.Panel` and `Sidebar.Inset` to make the desktop
sidebar resizable; it renders nothing on mobile. Dragging the rail updates the pixel width live
between `minWidth` and `maxWidth`. Releasing a drag that changed the width calls `onWidthCommit`
once, and each keyboard resize calls it too. A click without movement toggles the sidebar, and
dragging below half of `minWidth` closes it; drag back to reopen. Set `disabled` on the rail to turn
off resizing and toggling. Because the root is a splitter scope, a nested `Resizable` inside
`Sidebar.Inset` whose handle has `intersection` and touches the rail cross-drags both.

| Key                                                          | Action                                                 |
| ------------------------------------------------------------ | ------------------------------------------------------ |
| Growth arrow (`ArrowRight` or `ArrowLeft`, follows geometry) | Grows the panel by 16px.                               |
| Growth arrow + `Shift`                                       | Grows the panel by 1px.                                |
| Opposite arrow                                               | Shrinks the panel; clamps at `minWidth`, never closes. |
| `Home` / `End`                                               | Sets the width to `minWidth` / `maxWidth`.             |
| `Enter`                                                      | Toggles open; the only key that acts while closed.     |

To persist desktop layout across reloads, control `open` and `width` from the app and store them in
a cookie inside `onOpenChange` and `onWidthCommit`. Do not use `localStorage`, which mismatches SSR
hydration.

### Navigation menu

Build labeled navigation with these parts:

- `Sidebar.Group`: section container that holds a label and a menu
- `Sidebar.GroupLabel`: section title; set `as="h2"` or another tag when the page needs a heading
- `Sidebar.Menu`: `<ul>` list of the items of a group
- `Sidebar.MenuItem`: `<li>` that holds one `MenuButton` with an optional `MenuAction`, or a
  `MenuSub`
- `Sidebar.MenuButton`: polymorphic button (`button`, `a` when `href` is set, or a custom link
  through `as`) with `leading` and `trailing` icon names and `active`. It owns the hover, active,
  focus, and disabled styles. On a link, `active` also sets `aria-current="page"`
- `Sidebar.MenuAction`: controls placed over the end of the item's first row, such as a dropdown
  menu trigger. The button stays highlighted while the pointer is over the action. The button does
  not reserve space for the action, so add `pe-8` to a `MenuButton` whose label can run under it
- `Sidebar.MenuSub` / `MenuSubTrigger` / `MenuSubContent`: collapsible sub-navigation built on
  `Collapsible`, placed inside a `MenuItem`. `MenuSub` takes `open`, `defaultOpen`, `onOpenChange`,
  `disabled`, `transition` (animates the height), and `forceMount`. `MenuSubTrigger` renders a
  `MenuButton` with a chevron (`trailing`) that rotates while expanded. `MenuSubContent` renders a
  nested `<ul>` of `MenuItem`s

```tsx
<Sidebar.Group>
  <Sidebar.GroupLabel>Architecture</Sidebar.GroupLabel>
  <Sidebar.Menu>
    <Sidebar.MenuItem>
      <Sidebar.MenuSub defaultOpen>
        <Sidebar.MenuSubTrigger leading="i-lucide:route">Routing</Sidebar.MenuSubTrigger>
        <Sidebar.MenuSubContent>
          <Sidebar.MenuItem>
            <Sidebar.MenuButton href="/layouts">Pages and Layouts</Sidebar.MenuButton>
          </Sidebar.MenuItem>
        </Sidebar.MenuSubContent>
      </Sidebar.MenuSub>
    </Sidebar.MenuItem>
  </Sidebar.Menu>
</Sidebar.Group>
```

Use [DropdownMenu](https://moraine.subf.dev/components/dropdown-menu.md) inside header, footer, or `Sidebar.MenuAction` for workspace
switchers and row actions. Those menus are actions, not the sidebar's navigation tree.

## Examples

### Cloud console shell

Keep one navigation tree for desktop and mobile. Place the trigger in the main header so compact
viewports can open the drawer.

```tsx
import { Avatar, Badge, Breadcrumb, Button, Icon, Kbd, Separator, Sidebar } from 'moraine'
import type { BreadcrumbT } from 'moraine'
import { For, Show } from 'solid-js'

export function ResponsiveUsage() {
  const breadcrumbItems = [
    { label: 'Acme Cloud', href: '#' },
    { label: 'Platform', href: '#' },
    { label: 'Deployments' },
  ] satisfies BreadcrumbT.Item[]

  const navPlatform = [
    { label: 'Dashboard', icon: 'i-lucide:layout-dashboard', href: '#' },
    { label: 'Deployments', icon: 'i-lucide:rocket', href: '#', active: true, badge: '12' },
    { label: 'Analytics', icon: 'i-lucide:bar-chart-3', href: '#' },
    { label: 'Cloud Logs', icon: 'i-lucide:terminal', href: '#' },
  ]

  const navSettings = [
    { label: 'Team Members', icon: 'i-lucide:users', href: '#' },
    { label: 'API Keys', icon: 'i-lucide:key', href: '#' },
    { label: 'Billing & Usage', icon: 'i-lucide:credit-card', href: '#' },
  ]

  const deployments = [
    { name: 'api-gateway', env: 'Production • us-east-1', status: 'Live', time: '2m ago' },
    { name: 'auth-service', env: 'Staging • eu-west-1', status: 'Building', time: '5m ago' },
    { name: 'worker-pool', env: 'Production • us-west-2', status: 'Live', time: '18m ago' },
  ]

  return (
    <div class="border border-border rounded-xl bg-background h-96 w-full shadow-xs overflow-hidden">
      <Sidebar>
        <Sidebar.Panel class="border-r border-border/60 bg-card/40">
          <Sidebar.Header class="px-4 border-b border-border/60 h-11 justify-between">
            <div class="flex gap-2.5 min-w-0 items-center">
              <div class="text-xs text-primary-foreground font-bold rounded-md bg-primary flex shrink-0 size-7 items-center justify-center">
                <Icon name="i-lucide:command" class="size-4" />
              </div>
              <div class="flex flex-col min-w-0">
                <span class="text-xs leading-tight font-semibold truncate">Acme Cloud</span>
                <span class="text-[10px] text-muted-foreground leading-tight truncate">
                  Production org
                </span>
              </div>
            </div>
            <Badge size="sm" variant="soft">
              Pro
            </Badge>
          </Sidebar.Header>

          <Sidebar.Content>
            <div class="text-xs text-muted-foreground mx-2 mt-2 px-2 py-1.5 border border-border/60 rounded-md bg-muted/30 flex items-center justify-between">
              <div class="flex gap-1.5 items-center">
                <Icon name="i-lucide:search" class="opacity-70 size-3.5" />
                <span>Search...</span>
              </div>
              <div class="flex gap-0.5 items-center">
                <Kbd size="sm" value="meta" />
                <Kbd size="sm" value="K" />
              </div>
            </div>

            <Sidebar.Group>
              <Sidebar.GroupLabel>Platform</Sidebar.GroupLabel>
              <Sidebar.Menu>
                <For each={navPlatform}>
                  {(item) => (
                    <Sidebar.MenuItem>
                      <Sidebar.MenuButton href={item.href} leading={item.icon} active={item.active}>
                        <span class="flex-1 truncate">{item.label}</span>
                        <Show when={item.badge}>
                          <Badge size="sm" variant="soft" class="ml-auto shrink-0">
                            {item.badge}
                          </Badge>
                        </Show>
                      </Sidebar.MenuButton>
                    </Sidebar.MenuItem>
                  )}
                </For>
              </Sidebar.Menu>
            </Sidebar.Group>

            <Sidebar.Group>
              <Sidebar.GroupLabel>Configuration</Sidebar.GroupLabel>
              <Sidebar.Menu>
                <For each={navSettings}>
                  {(item) => (
                    <Sidebar.MenuItem>
                      <Sidebar.MenuButton href={item.href} leading={item.icon}>
                        {item.label}
                      </Sidebar.MenuButton>
                    </Sidebar.MenuItem>
                  )}
                </For>
              </Sidebar.Menu>
            </Sidebar.Group>
          </Sidebar.Content>

          <Sidebar.Footer class="px-4 py-2 border-t border-border/60 justify-between">
            <div class="flex gap-2 min-w-0 items-center">
              <Avatar text="AR" size="sm" />
              <div class="flex flex-col min-w-0">
                <span class="text-xs leading-tight font-medium truncate">Alex Rivers</span>
                <span class="text-[10px] text-muted-foreground leading-tight truncate">
                  alex@acme.com
                </span>
              </div>
            </div>
            <Button variant="ghost" size="icon-xs" aria-label="User preferences">
              <Icon name="i-lucide:ellipsis-vertical" class="size-3.5" />
            </Button>
          </Sidebar.Footer>
        </Sidebar.Panel>

        <Sidebar.Inset class="flex flex-col">
          <header class="px-3 border-b border-border/60 flex shrink-0 gap-2 h-11 items-center">
            <Sidebar.Trigger as={Button} variant="ghost" size="icon-sm" aria-label="Toggle sidebar">
              <Icon name="i-lucide:menu" class="size-4" />
            </Sidebar.Trigger>
            <Separator orientation="vertical" class="h-4" />
            <Breadcrumb items={breadcrumbItems} />
            <div class="flex-1" />
            <Button size="xs" leading="i-lucide:plus">
              New Deployment
            </Button>
          </header>

          <div class="p-4 flex-1 space-y-4">
            <div class="gap-2.5 grid grid-cols-3">
              <div class="p-2.5 border border-border/60 rounded-lg bg-card/60">
                <div class="text-[11px] text-muted-foreground">Active Services</div>
                <div class="text-base font-bold mt-0.5">24 / 24</div>
              </div>
              <div class="p-2.5 border border-border/60 rounded-lg bg-card/60">
                <div class="text-[11px] text-muted-foreground">Global Uptime</div>
                <div class="text-base text-emerald-600 font-bold mt-0.5 dark:text-emerald-400">
                  99.98%
                </div>
              </div>
              <div class="p-2.5 border border-border/60 rounded-lg bg-card/60">
                <div class="text-[11px] text-muted-foreground">Avg Latency</div>
                <div class="text-base font-bold mt-0.5">42 ms</div>
              </div>
            </div>

            <div class="border border-border/60 rounded-lg bg-card/40 overflow-hidden">
              <div class="text-xs font-semibold px-3 py-2 border-b border-border/60 flex items-center justify-between">
                <span>Recent Deployments</span>
                <span class="text-[10px] text-muted-foreground font-normal">Auto-synced</span>
              </div>
              <div class="divide-border/40 divide-y">
                <For each={deployments}>
                  {(item) => (
                    <div class="text-xs px-3 py-2 flex items-center justify-between">
                      <div class="flex flex-col">
                        <span class="font-medium">{item.name}</span>
                        <span class="text-[10px] text-muted-foreground">{item.env}</span>
                      </div>
                      <div class="flex gap-2 items-center">
                        <Badge
                          size="sm"
                          variant={item.status === 'Live' ? 'soft' : 'outline'}
                          leading={
                            item.status === 'Live'
                              ? 'i-lucide:check-circle-2'
                              : 'i-lucide:loader-circle'
                          }
                        >
                          {item.status}
                        </Badge>
                        <span class="text-[10px] text-muted-foreground">{item.time}</span>
                      </div>
                    </div>
                  )}
                </For>
              </div>
            </div>
          </div>
        </Sidebar.Inset>
      </Sidebar>
    </div>
  )
}
```

### Docs tree with collapsible sections

Put a `MenuSub` inside a `MenuItem` for multi-level docs. The trigger only toggles its section,
so link the section's pages from the nested items.

```tsx
import { Badge, Breadcrumb, Button, Icon, Separator, Sidebar } from 'moraine'
import { For, createSignal } from 'solid-js'

export function CollapsibleGroups() {
  const [activePage, setActivePage] = createSignal('Pages and Layouts')

  const breadcrumbItems = () => [
    { label: 'Documentation', href: '#' },
    { label: 'Application Architecture', href: '#' },
    { label: activePage() },
  ]

  return (
    <div class="border border-border rounded-xl bg-background h-[420px] w-full shadow-xs overflow-hidden">
      <Sidebar mobile={false}>
        <Sidebar.Panel class="border-r border-border/60 bg-card/40 w-64">
          <Sidebar.Header class="px-4 border-b border-border/60 h-11 justify-between">
            <div class="text-xs font-bold flex gap-2 items-center">
              <div class="text-white rounded-md bg-emerald-600 flex size-6 items-center justify-center">
                <Icon name="i-lucide:book-open" class="size-3.5" />
              </div>
              <span>Framework Docs</span>
            </div>
            <Badge size="sm" variant="outline">
              v3.0
            </Badge>
          </Sidebar.Header>

          <Sidebar.Content>
            <Sidebar.Group>
              <Sidebar.GroupLabel class="text-[10px] tracking-wider font-semibold uppercase">
                Overview
              </Sidebar.GroupLabel>
              <Sidebar.Menu>
                <Sidebar.MenuItem>
                  <Sidebar.MenuButton
                    leading="i-lucide:compass"
                    active={activePage() === 'Getting Started'}
                    onClick={() => setActivePage('Getting Started')}
                  >
                    Getting Started
                  </Sidebar.MenuButton>
                </Sidebar.MenuItem>
                <Sidebar.MenuItem>
                  <Sidebar.MenuButton
                    leading="i-lucide:rocket"
                    active={activePage() === 'Quickstart'}
                    onClick={() => setActivePage('Quickstart')}
                  >
                    Quickstart
                  </Sidebar.MenuButton>
                </Sidebar.MenuItem>
              </Sidebar.Menu>
            </Sidebar.Group>

            <Sidebar.Group>
              <Sidebar.GroupLabel class="text-[10px] tracking-wider font-semibold uppercase">
                Architecture
              </Sidebar.GroupLabel>
              <Sidebar.Menu>
                <Sidebar.MenuItem>
                  <Sidebar.MenuSub defaultOpen transition>
                    <Sidebar.MenuSubTrigger leading="i-lucide:route">
                      Routing
                    </Sidebar.MenuSubTrigger>
                    <Sidebar.MenuSubContent>
                      <For each={['Defining Routes', 'Pages and Layouts', 'Navigation & Links']}>
                        {(item) => (
                          <Sidebar.MenuItem>
                            <Sidebar.MenuButton
                              active={activePage() === item}
                              onClick={() => setActivePage(item)}
                            >
                              {item}
                            </Sidebar.MenuButton>
                          </Sidebar.MenuItem>
                        )}
                      </For>
                    </Sidebar.MenuSubContent>
                  </Sidebar.MenuSub>
                </Sidebar.MenuItem>

                <Sidebar.MenuItem>
                  <Sidebar.MenuSub transition>
                    <Sidebar.MenuSubTrigger leading="i-lucide:database">
                      Data Fetching
                    </Sidebar.MenuSubTrigger>
                    <Sidebar.MenuSubContent>
                      <For
                        each={['Server Actions', 'Streaming & Suspense', 'Caching & Revalidation']}
                      >
                        {(item) => (
                          <Sidebar.MenuItem>
                            <Sidebar.MenuButton
                              active={activePage() === item}
                              onClick={() => setActivePage(item)}
                            >
                              {item}
                            </Sidebar.MenuButton>
                          </Sidebar.MenuItem>
                        )}
                      </For>
                    </Sidebar.MenuSubContent>
                  </Sidebar.MenuSub>
                </Sidebar.MenuItem>
              </Sidebar.Menu>
            </Sidebar.Group>
          </Sidebar.Content>

          <Sidebar.Footer class="text-xs text-muted-foreground px-4 py-2.5 border-t border-border/60 justify-between">
            <span class="text-[11px]">SolidJS v1.9 Ecosystem</span>
            <Icon name="i-lucide:external-link" class="opacity-60 size-3" />
          </Sidebar.Footer>
        </Sidebar.Panel>

        <Sidebar.Inset class="flex flex-col">
          <header class="px-3 border-b border-border/60 flex shrink-0 gap-2 h-11 items-center">
            <Sidebar.Trigger
              as={Button}
              variant="ghost"
              size="icon-sm"
              aria-label="Toggle navigation"
            >
              <Icon name="i-lucide:menu" class="size-4" />
            </Sidebar.Trigger>
            <Separator orientation="vertical" class="h-4" />
            <Breadcrumb items={breadcrumbItems()} />
          </header>

          <div class="p-5 flex-1 overflow-y-auto space-y-4">
            <div>
              <div class="text-xs text-primary font-semibold">Architecture / Routing</div>
              <h2 class="text-lg text-foreground font-bold mt-0.5">{activePage()}</h2>
              <p class="text-xs text-muted-foreground leading-relaxed mt-1">
                Learn how nested layouts and leaf pages compose seamlessly in modern file-based
                routers without unnecessary re-renders.
              </p>
            </div>

            <div class="text-xs font-mono p-3 border border-border/60 rounded-lg bg-muted/30 space-y-1">
              <div class="text-muted-foreground">// Example page component definition</div>
              <div>
                <span class="text-purple-500">export default function</span>{' '}
                <span class="text-blue-500">Page</span>() {'{'}
              </div>
              <div class="pl-4">
                <span class="text-purple-500">return</span>{' '}
                <span class="text-emerald-600 dark:text-emerald-400">
                  {'<h1>Welcome to '}
                  {activePage()}
                  {'</h1>'}
                </span>
              </div>
              <div>{'}'}</div>
            </div>

            <div class="text-xs pt-3 border-t border-border/50 flex items-center justify-between">
              <Button variant="outline" size="xs" leading="i-lucide:arrow-left">
                Previous: Defining Routes
              </Button>
              <Button size="xs" trailing="i-lucide:arrow-right">
                Next: Navigation & Links
              </Button>
            </div>
          </div>
        </Sidebar.Inset>
      </Sidebar>
    </div>
  )
}
```

### Inspector beside a document

Use `side="right"` and `variant="inset"` for a properties panel next to a canvas or RFC.

```tsx
import { Avatar, Badge, Button, Icon, Separator, Sidebar } from 'moraine'
import { For } from 'solid-js'

export function SideAndVariantUsage() {
  const reviewers = [
    { name: 'Sarah C.', approved: true },
    { name: 'David M.', approved: true },
    { name: 'Kenji S.', approved: false },
  ]

  const tags = ['Architecture', 'RFC', 'High Priority', 'v4.2']

  return (
    <div class="border border-border rounded-xl bg-muted/20 h-96 w-full shadow-xs overflow-hidden">
      <Sidebar mobile={false} side="right" variant="inset">
        <Sidebar.Panel class="bg-card/60 w-64">
          <Sidebar.Header class="px-4 border-b border-border/60 h-11 justify-between">
            <div class="flex gap-2 items-center">
              <Icon name="i-lucide:sliders-horizontal" class="text-muted-foreground size-3.5" />
              <span class="text-xs font-semibold">Document Inspector</span>
            </div>
            <Button variant="ghost" size="icon-xs" aria-label="Inspector options">
              <Icon name="i-lucide:more-horizontal" class="size-3.5" />
            </Button>
          </Sidebar.Header>

          <Sidebar.Content class="px-4 py-3 space-y-4">
            <div class="space-y-1.5">
              <div class="text-[10px] text-muted-foreground tracking-wider font-semibold uppercase">
                Review Status
              </div>
              <div class="flex gap-2 items-center">
                <Badge variant="soft" size="sm" leading="i-lucide:git-pull-request">
                  In Review (2/3)
                </Badge>
              </div>
            </div>

            <Separator class="my-2" />

            <div class="space-y-2">
              <div class="text-[10px] text-muted-foreground tracking-wider font-semibold uppercase">
                Document Owner
              </div>
              <div class="flex gap-2 items-center">
                <Avatar text="ER" size="sm" />
                <span class="text-xs font-medium">Elena Rostova</span>
              </div>
            </div>

            <div class="space-y-2">
              <div class="text-[10px] text-muted-foreground tracking-wider font-semibold uppercase">
                Design Reviewers
              </div>
              <div class="space-y-1.5">
                <For each={reviewers}>
                  {(reviewer) => (
                    <div class="text-xs flex items-center justify-between">
                      <span class="text-muted-foreground">{reviewer.name}</span>
                      <Icon
                        name={reviewer.approved ? 'i-lucide:check-circle-2' : 'i-lucide:clock'}
                        class={`size-3.5 ${
                          reviewer.approved
                            ? 'text-emerald-600 dark:text-emerald-400'
                            : 'text-muted-foreground/60'
                        }`}
                      />
                    </div>
                  )}
                </For>
              </div>
            </div>

            <div class="space-y-1.5">
              <div class="text-[10px] text-muted-foreground tracking-wider font-semibold uppercase">
                Tags & Milestones
              </div>
              <div class="flex flex-wrap gap-1">
                <For each={tags}>
                  {(tag) => (
                    <Badge size="sm" variant="outline">
                      {tag}
                    </Badge>
                  )}
                </For>
              </div>
            </div>
          </Sidebar.Content>

          <Sidebar.Footer class="px-4 py-3 border-t border-border/60">
            <Button size="xs" variant="outline" class="flex-1">
              Changes
            </Button>
            <Button size="xs" class="flex-1">
              Approve
            </Button>
          </Sidebar.Footer>
        </Sidebar.Panel>
        <Sidebar.Inset class="flex flex-col overflow-hidden">
          <div class="px-4 border-b border-border/60 flex shrink-0 h-11 items-center justify-between">
            <div class="flex gap-2 items-center">
              <Badge variant="soft" size="sm">
                RFC-104
              </Badge>
              <span class="text-xs text-muted-foreground">Updated 14 minutes ago</span>
            </div>
            <span class="text-[11px] text-muted-foreground font-mono">SHA: 8f42c90</span>
          </div>

          <div class="p-4 flex-1 overflow-y-auto space-y-3">
            <div>
              <h3 class="text-sm text-foreground font-bold">
                Unified Distributed Cache Architecture
              </h3>
              <p class="text-xs text-muted-foreground leading-relaxed mt-1">
                Proposed multi-region cache synchronization protocol for sub-millisecond edge reads
                and automated cache invalidation upon ledger updates.
              </p>
            </div>

            <div class="p-3 border border-border rounded-lg bg-card space-y-2">
              <div class="text-xs font-semibold flex gap-1.5 items-center">
                <Icon name="i-lucide:list-checks" class="text-primary size-4" />
                <span>Verification Requirements</span>
              </div>
              <ul class="text-xs text-muted-foreground pl-5 list-disc space-y-1">
                <li>Under 5ms replication latency across tier-1 regional zones</li>
                <li>Zero cache poisoning on concurrent write split-brain failover</li>
                <li>Linear scaling up to 100,000 requests per node per second</li>
              </ul>
            </div>
          </div>

          <div class="text-xs text-muted-foreground px-4 py-2 border-t border-border/50 flex shrink-0 items-center justify-between">
            <span>Author: elena.rostova@distributed.io</span>
            <span>Target: v4.2-LTS</span>
          </div>
        </Sidebar.Inset>
      </Sidebar>
    </div>
  )
}
```

### Team switcher and account menu

Put a workspace `DropdownMenu` in the header slot and an account menu in the footer.

```tsx
import { Avatar, Badge, Button, DropdownMenu, Icon, Sidebar } from 'moraine'
import type { DropdownMenuT } from 'moraine'
import { For, createSignal } from 'solid-js'

export function HeaderFooterSlots() {
  const [currentTeam, setCurrentTeam] = createSignal('Acme Corp')
  const [currentProject, setCurrentProject] = createSignal('Core Engine v2')

  const teamItems = [
    {
      label: 'Acme Corp',
      icon: 'i-lucide:building-2',
      onSelect: () => setCurrentTeam('Acme Corp'),
    },
    {
      label: 'Acme Labs',
      icon: 'i-lucide:flask-conical',
      onSelect: () => setCurrentTeam('Acme Labs'),
    },
    {
      label: 'Personal Space',
      icon: 'i-lucide:user',
      onSelect: () => setCurrentTeam('Personal Space'),
    },
    { type: 'separator' as const },
    {
      label: 'Add Workspace',
      icon: 'i-lucide:plus',
      onSelect: () => {},
    },
  ] satisfies DropdownMenuT.Item[]

  const userItems = [
    { label: 'Account Settings', icon: 'i-lucide:settings' },
    { label: 'Billing & Invoices', icon: 'i-lucide:credit-card' },
    { label: 'Notifications', icon: 'i-lucide:bell' },
    { type: 'separator' as const },
    { label: 'Log out', icon: 'i-lucide:log-out', variant: 'danger' as const },
  ] satisfies DropdownMenuT.Item[]

  const projects = [
    { name: 'Core Engine v2', role: 'Architecture Lead', icon: 'i-lucide:cpu', branch: 'main' },
    {
      name: 'Design System',
      role: 'Core Maintainer',
      icon: 'i-lucide:palette',
      branch: 'release/v3',
    },
    {
      name: 'Customer Portal',
      role: 'Reviewer',
      icon: 'i-lucide:layout-template',
      branch: 'feature/auth',
    },
    {
      name: 'Analytics Pipeline',
      role: 'Contributor',
      icon: 'i-lucide:bar-chart-2',
      branch: 'trunk',
    },
  ]

  return (
    <div class="border border-border rounded-xl bg-background h-96 w-full shadow-xs overflow-hidden">
      <Sidebar mobile={false}>
        <Sidebar.Panel class="border-r border-border/60 bg-card/40 w-60">
          {/* Header slot: Team Switcher Dropdown */}
          <Sidebar.Header class="border-b border-border/60 h-12">
            <DropdownMenu>
              <DropdownMenu.Trigger
                as={Button}
                variant="ghost"
                class="px-2 py-1.5 h-auto w-full justify-between"
                trailing="i-lucide:chevrons-up-down"
              >
                <div class="text-left flex gap-2.5 min-w-0 items-center">
                  <div class="text-xs text-primary-foreground font-bold rounded-md bg-primary flex shrink-0 size-7 items-center justify-center">
                    <Icon name="i-lucide:gallery-vertical-end" class="size-3.5" />
                  </div>
                  <div class="flex flex-col min-w-0">
                    <span class="text-xs leading-tight font-semibold truncate">
                      {currentTeam()}
                    </span>
                    <span class="text-[10px] text-muted-foreground leading-tight truncate">
                      Enterprise Tier
                    </span>
                  </div>
                </div>
              </DropdownMenu.Trigger>
              <DropdownMenu.Content items={teamItems} />
            </DropdownMenu>
          </Sidebar.Header>

          {/* Body slot: Projects list */}
          <Sidebar.Content>
            <Sidebar.Group>
              <Sidebar.GroupLabel class="text-[10px] tracking-wider font-semibold flex uppercase items-center justify-between">
                <span>Active Projects</span>
                <Badge size="sm" variant="outline">
                  {projects.length}
                </Badge>
              </Sidebar.GroupLabel>
              <Sidebar.Menu>
                <For each={projects}>
                  {(proj) => (
                    <Sidebar.MenuItem>
                      <Sidebar.MenuButton
                        leading={proj.icon}
                        active={currentProject() === proj.name}
                        onClick={() => setCurrentProject(proj.name)}
                      >
                        {proj.name}
                      </Sidebar.MenuButton>
                    </Sidebar.MenuItem>
                  )}
                </For>
              </Sidebar.Menu>
            </Sidebar.Group>
          </Sidebar.Content>

          {/* Footer slot: User Profile Dropdown */}
          <Sidebar.Footer class="border-t border-border/60">
            <DropdownMenu>
              <DropdownMenu.Trigger
                as={Button}
                variant="ghost"
                class="px-2 py-1.5 h-auto w-full justify-between"
                trailing="i-lucide:chevrons-up-down"
              >
                <div class="text-left flex gap-2 min-w-0 items-center">
                  <Avatar text="SC" size="sm" />
                  <div class="flex flex-col min-w-0">
                    <span class="text-xs leading-tight font-medium truncate">Sarah Connor</span>
                    <span class="text-[10px] text-muted-foreground leading-tight truncate">
                      sarah@acme.com
                    </span>
                  </div>
                </div>
              </DropdownMenu.Trigger>
              <DropdownMenu.Content items={userItems} />
            </DropdownMenu>
          </Sidebar.Footer>
        </Sidebar.Panel>

        <Sidebar.Inset class="flex flex-col overflow-hidden">
          <div class="px-5 border-b border-border/60 flex shrink-0 h-12 items-center justify-between">
            <div class="flex gap-2 items-center">
              <Icon name="i-lucide:folder-git-2" class="text-primary size-4" />
              <h3 class="text-sm font-bold">{currentProject()}</h3>
            </div>
            <Badge size="sm" variant="soft">
              Active Repository
            </Badge>
          </div>

          <div class="p-5 flex-1 overflow-y-auto space-y-4">
            <p class="text-xs text-muted-foreground leading-relaxed">
              Real-time pipeline orchestration and workload routing system. Synchronized across
              production worker fleets.
            </p>

            <div class="gap-3 grid grid-cols-2">
              <div class="p-3 border border-border/60 rounded-lg bg-card/50">
                <div class="text-[11px] text-muted-foreground">Current Branch</div>
                <div class="text-xs font-bold font-mono mt-1 flex gap-1.5 items-center">
                  <Icon name="i-lucide:git-branch" class="text-primary size-3" />
                  main
                </div>
              </div>
              <div class="p-3 border border-border/60 rounded-lg bg-card/50">
                <div class="text-[11px] text-muted-foreground">Open Pull Requests</div>
                <div class="text-xs font-bold mt-1 flex gap-1.5 items-center">
                  <Icon name="i-lucide:git-pull-request" class="text-emerald-600 size-3" />4 ready
                  for merge
                </div>
              </div>
            </div>
          </div>

          <div class="text-xs text-muted-foreground px-5 py-2.5 border-t border-border/50 flex shrink-0 items-center justify-between">
            <span>Workspace: {currentTeam()}</span>
            <span>Last synced: just now</span>
          </div>
        </Sidebar.Inset>
      </Sidebar>
    </div>
  )
}
```

### Global topbar above the frame

Keep brand, project picker, and alerts outside `Sidebar`. Let the frame fill the remaining
height.

```tsx
import { Avatar, Badge, Button, Icon, Sidebar } from 'moraine'
import { For } from 'solid-js'

export function FrameRender() {
  const cloudNav = [
    { label: 'Kubernetes Clusters', icon: 'i-lucide:server', active: true },
    { label: 'Serverless Functions', icon: 'i-lucide:zap' },
    { label: 'Edge Storage', icon: 'i-lucide:database' },
    { label: 'Virtual Networks', icon: 'i-lucide:network' },
    { label: 'IAM & Security', icon: 'i-lucide:shield-check' },
    { label: 'Metrics & Observability', icon: 'i-lucide:activity' },
  ]

  const clusters = [
    { name: 'k8s-prod-primary', nodes: '48 nodes', region: 'us-east-1', health: 'Healthy' },
    { name: 'ingress-edge-mesh', nodes: '16 nodes', region: 'global-anycast', health: 'Healthy' },
    { name: 'db-replica-pool', nodes: '24 nodes', region: 'eu-west-1', health: 'Degraded' },
  ]

  return (
    <div class="border border-border rounded-xl bg-background flex flex-col h-[400px] w-full shadow-xs overflow-hidden">
      {/* Global Topbar outside the Sidebar */}
      <header class="px-4 border-b border-border bg-card/70 flex shrink-0 h-11 items-center justify-between">
        <div class="flex gap-3 items-center">
          <div class="text-xs font-bold flex gap-2 items-center">
            <div class="text-white rounded-md bg-blue-600 flex size-6 items-center justify-center">
              <Icon name="i-lucide:cloud" class="size-3.5" />
            </div>
            <span>HyperScale Cloud</span>
          </div>

          <div class="bg-border/60 h-4 w-px" />

          <button class="text-xs text-muted-foreground font-medium px-2 py-1 rounded-md bg-muted/50 flex gap-1.5 transition-colors items-center hover:text-foreground hover:bg-muted">
            <span>Project: prod-omega</span>
            <Icon name="i-lucide:chevron-down" class="size-3" />
          </button>
        </div>

        <div class="flex gap-2 items-center">
          <Button variant="ghost" size="icon-xs" aria-label="Cloud alarms">
            <div class="relative">
              <Icon name="i-lucide:bell" class="size-3.5" />
              <span class="rounded-full bg-amber-500 size-1.5 absolute -right-0.5 -top-0.5" />
            </div>
          </Button>
          <Avatar text="HC" size="sm" />
        </div>
      </header>

      {/* Embedded Sidebar taking remaining height */}
      <Sidebar mobile={false} class="flex-1 h-auto min-h-0">
        <Sidebar.Panel class="border-r border-border/60 bg-card/30 w-56">
          <Sidebar.Content>
            <Sidebar.Group>
              <Sidebar.GroupLabel class="text-[10px] tracking-wider font-semibold uppercase">
                Infrastructure
              </Sidebar.GroupLabel>
              <Sidebar.Menu>
                <For each={cloudNav}>
                  {(item) => (
                    <Sidebar.MenuItem>
                      <Sidebar.MenuButton href="#" leading={item.icon} active={item.active}>
                        {item.label}
                      </Sidebar.MenuButton>
                    </Sidebar.MenuItem>
                  )}
                </For>
              </Sidebar.Menu>
            </Sidebar.Group>
          </Sidebar.Content>

          <Sidebar.Footer class="text-[11px] text-muted-foreground px-4 py-2 border-t border-border/60 justify-between">
            <span>Region: us-east-1</span>
            <span class="rounded-full bg-emerald-500 size-2" />
          </Sidebar.Footer>
        </Sidebar.Panel>

        <Sidebar.Inset class="p-4 overflow-y-auto space-y-4">
          <div class="flex items-center justify-between">
            <div>
              <h3 class="text-sm font-bold">Active Kubernetes Clusters</h3>
              <p class="text-xs text-muted-foreground">
                Manage and observe distributed workload clusters
              </p>
            </div>
            <Button size="xs" leading="i-lucide:plus">
              Provision Cluster
            </Button>
          </div>

          <div class="gap-3 grid grid-cols-3">
            <div class="p-2.5 border border-border/60 rounded-lg bg-card/60">
              <div class="text-[11px] text-muted-foreground">Total CPU Allocation</div>
              <div class="text-base font-bold mt-0.5">74%</div>
              <div class="mt-2 rounded-full bg-muted h-1.5 w-full overflow-hidden">
                <div class="rounded-full bg-blue-600 h-full w-3/4" />
              </div>
            </div>
            <div class="p-2.5 border border-border/60 rounded-lg bg-card/60">
              <div class="text-[11px] text-muted-foreground">Cluster Memory Pool</div>
              <div class="text-base font-bold mt-0.5">61%</div>
              <div class="mt-2 rounded-full bg-muted h-1.5 w-full overflow-hidden">
                <div class="rounded-full bg-indigo-600 h-full w-3/5" />
              </div>
            </div>
            <div class="p-2.5 border border-border/60 rounded-lg bg-card/60">
              <div class="text-[11px] text-muted-foreground">Network Ingress</div>
              <div class="text-base font-bold mt-0.5">1.4 Gbps</div>
              <div class="mt-2 rounded-full bg-muted h-1.5 w-full overflow-hidden">
                <div class="rounded-full bg-emerald-600 h-full w-2/5" />
              </div>
            </div>
          </div>

          <div class="border border-border/60 rounded-lg bg-card/50 overflow-hidden">
            <div class="divide-border/40 divide-y">
              <For each={clusters}>
                {(cluster) => (
                  <div class="text-xs px-3 py-2.5 flex items-center justify-between">
                    <div class="flex gap-2.5 items-center">
                      <Icon name="i-lucide:server" class="text-muted-foreground size-4" />
                      <div>
                        <div class="font-semibold">{cluster.name}</div>
                        <div class="text-[10px] text-muted-foreground">
                          {cluster.nodes} • {cluster.region}
                        </div>
                      </div>
                    </div>
                    <Badge
                      size="sm"
                      variant={cluster.health === 'Healthy' ? 'soft' : 'outline'}
                      leading={
                        cluster.health === 'Healthy'
                          ? 'i-lucide:check-circle-2'
                          : 'i-lucide:alert-triangle'
                      }
                    >
                      {cluster.health}
                    </Badge>
                  </div>
                )}
              </For>
            </div>
          </div>
        </Sidebar.Inset>
      </Sidebar>
    </div>
  )
}
```

### Resize the explorer on desktop

`Sidebar.Rail` between `Panel` and `Inset` resizes the sidebar in pixels. On mobile, the same content
moves into the Drawer and the rail disappears.

```tsx
import { Icon, Sidebar } from 'moraine'
import { For, createSignal } from 'solid-js'

function FileExplorerContent() {
  const files = [
    { name: 'src', type: 'folder-open', level: 0 },
    { name: 'components', type: 'folder', level: 1 },
    { name: 'navigation', type: 'folder-open', level: 1 },
    { name: 'sidebar.tsx', type: 'file-code', level: 2, active: true },
    { name: 'sidebar.recipe.ts', type: 'file-code', level: 2 },
    { name: 'index.ts', type: 'file-code', level: 1 },
    { name: 'package.json', type: 'file-json', level: 0 },
    { name: 'README.md', type: 'file-text', level: 0 },
  ]

  const getIcon = (type: string) => {
    switch (type) {
      case 'folder':
        return 'i-lucide:folder'
      case 'folder-open':
        return 'i-lucide:folder-open'
      case 'file-json':
        return 'i-lucide:file-json'
      case 'file-text':
        return 'i-lucide:file-text'
      default:
        return 'i-lucide:file-code'
    }
  }

  return (
    <>
      <Sidebar.Header class="px-4 border-b border-border/60 h-9 items-center">
        <span class="text-[11px] text-muted-foreground tracking-wider font-bold uppercase">
          Explorer: Moraine
        </span>
      </Sidebar.Header>

      <Sidebar.Content class="p-2 space-y-0.5">
        <For each={files}>
          {(file) => (
            <div
              class={`text-xs px-2 py-1 rounded flex gap-2 cursor-pointer transition-colors items-center ${
                file.active
                  ? 'bg-accent text-accent-foreground font-medium'
                  : 'text-muted-foreground hover:bg-muted/60 hover:text-foreground'
              }`}
              style={{ 'padding-left': `${(file.level + 1) * 8}px` }}
            >
              <Icon
                name={getIcon(file.type)}
                class={`shrink-0 size-3.5 ${file.type.startsWith('folder') ? 'text-amber-500' : 'text-blue-500'}`}
              />
              <span class="truncate">{file.name}</span>
            </div>
          )}
        </For>
      </Sidebar.Content>
    </>
  )
}

export function ResizableRail() {
  const [width, setWidth] = createSignal(240)

  return (
    <div class="border border-border rounded-xl bg-background h-96 w-full shadow-xs overflow-hidden">
      <Sidebar
        width={width()}
        onWidthChange={setWidth}
        minWidth={200}
        maxWidth={320}
        class="h-full"
      >
        <Sidebar.Panel class="bg-card/40">
          <FileExplorerContent />
        </Sidebar.Panel>
        <Sidebar.Rail />
        <Sidebar.Inset class="bg-card/30 flex flex-col">
          <div class="text-xs px-3 border-b border-border/60 bg-muted/40 flex shrink-0 h-9 items-center justify-between">
            <div class="font-medium flex gap-2 items-center">
              <Icon name="i-lucide:file-code" class="text-blue-500 size-3.5" />
              <span>sidebar.tsx</span>
            </div>
            <Sidebar.Trigger aria-label="Toggle sidebar" />
          </div>
          <div class="text-xs font-mono p-4 flex-1">
            <div class="text-muted-foreground/60">// Drag the rail or use the arrow keys</div>
            <div>
              <span class="text-purple-500">width</span> ={' '}
              <span class="text-blue-500 font-semibold">{width()}</span>
              <span class="text-muted-foreground">px</span>
            </div>
          </div>
        </Sidebar.Inset>
      </Sidebar>
    </div>
  )
}
```

### Force the mobile drawer

Set `mobile` to render the slide-over navigation drawer at any viewport width, for example in a
touch-first layout.

```tsx
import { Avatar, Badge, Button, Icon, Sidebar } from 'moraine'
import { For, Show } from 'solid-js'

export function ForcedMobile() {
  const mobileNav = [
    { label: 'Overview', icon: 'i-lucide:home', active: true },
    { label: 'Cards & Wallets', icon: 'i-lucide:credit-card', badge: '3' },
    { label: 'Transfers & Payments', icon: 'i-lucide:arrow-left-right' },
    { label: 'Analytics & Insights', icon: 'i-lucide:pie-chart' },
    { label: 'Security & Limits', icon: 'i-lucide:shield-check' },
    { label: 'Customer Support', icon: 'i-lucide:message-square' },
  ]

  const transactions = [
    { name: 'Stripe Payout', type: 'Deposit', amount: '+$3,450.00', positive: true },
    { name: 'Figma Subscription', type: 'Software', amount: '-$15.00', positive: false },
    { name: 'Coffee Roasters', type: 'Food & Dining', amount: '-$6.25', positive: false },
  ]

  return (
    <div class="mx-auto b b-border flex flex-col h-150 max-w-xs w-full overflow-hidden">
      <Sidebar mobile>
        <Sidebar.Panel class="bg-card">
          <Sidebar.Header class="px-4 py-3 border-b border-border/60 justify-between">
            <div class="text-sm font-bold flex gap-2 items-center">
              <div class="text-white rounded-lg bg-emerald-600 flex size-7 items-center justify-center">
                <Icon name="i-lucide:wallet" class="size-4" />
              </div>
              <span>PocketPay</span>
            </div>
            <Badge size="sm" variant="soft">
              v1.8
            </Badge>
          </Sidebar.Header>

          <Sidebar.Content class="p-2 space-y-1">
            <div class="text-[10px] text-muted-foreground tracking-wider font-semibold px-2 py-1 uppercase">
              Navigation
            </div>
            <For each={mobileNav}>
              {(item) => (
                <a
                  href="#"
                  class={`text-xs font-medium px-2 py-2 rounded-lg flex transition-colors items-center justify-between ${
                    item.active
                      ? 'bg-accent text-accent-foreground font-semibold'
                      : 'text-muted-foreground hover:bg-muted/60 hover:text-foreground'
                  }`}
                >
                  <div class="flex gap-2.5 items-center">
                    <Icon name={item.icon} class="shrink-0 size-4" />
                    <span>{item.label}</span>
                  </div>
                  <Show when={item.badge}>
                    <Badge size="sm" variant="soft">
                      {item.badge}
                    </Badge>
                  </Show>
                </a>
              )}
            </For>
          </Sidebar.Content>

          <Sidebar.Footer class="px-4 py-3 border-t border-border/60 justify-between">
            <div class="flex gap-2 items-center">
              <Avatar text="ML" size="sm" />
              <div class="flex flex-col">
                <span class="text-xs font-medium">Marcus Lee</span>
                <span class="text-[10px] text-muted-foreground">Premier Account</span>
              </div>
            </div>
            <Button variant="ghost" size="icon-xs" aria-label="Sign out">
              <Icon name="i-lucide:log-out" class="size-3.5" />
            </Button>
          </Sidebar.Footer>
        </Sidebar.Panel>

        <Sidebar.Inset class="bg-muted/10 flex flex-col h-full">
          {/* Mobile Shell Header */}
          <header class="px-3 py-2 border-b border-border/60 bg-background/80 flex shrink-0 items-center justify-between backdrop-blur">
            <Sidebar.Trigger
              as={Button}
              variant="ghost"
              size="icon-sm"
              aria-label="Open mobile menu"
            >
              <Icon name="i-lucide:menu" class="size-4" />
            </Sidebar.Trigger>

            <span class="text-xs font-semibold">PocketPay</span>

            <Button variant="ghost" size="icon-sm" aria-label="Notifications">
              <div class="relative">
                <Icon name="i-lucide:bell" class="size-4" />
                <span class="rounded-full bg-emerald-500 size-1.5 absolute -right-0.5 -top-0.5" />
              </div>
            </Button>
          </header>

          {/* Mobile Screen Body */}
          <div class="p-3 flex-1 overflow-y-auto space-y-3">
            {/* Balance Card */}
            <div class="text-white p-3.5 rounded-xl shadow-sm from-emerald-600 to-teal-700 bg-gradient-to-br space-y-2">
              <div class="text-[11px] opacity-80">Available Balance</div>
              <div class="text-xl tracking-tight font-bold">$24,580.45</div>
              <div class="text-[10px] opacity-90 flex gap-1 items-center">
                <Icon name="i-lucide:trending-up" class="size-3" />
                <span>+12.4% from last month</span>
              </div>
            </div>

            {/* Quick Actions */}
            <div class="text-center gap-2 grid grid-cols-3">
              <button class="text-xs p-2 border border-border/60 rounded-lg bg-card flex flex-col gap-1 transition-colors items-center hover:bg-muted/60">
                <Icon name="i-lucide:arrow-up-right" class="text-emerald-600 size-4" />
                <span class="text-[11px] font-medium">Send</span>
              </button>
              <button class="text-xs p-2 border border-border/60 rounded-lg bg-card flex flex-col gap-1 transition-colors items-center hover:bg-muted/60">
                <Icon name="i-lucide:arrow-down-left" class="text-teal-600 size-4" />
                <span class="text-[11px] font-medium">Receive</span>
              </button>
              <button class="text-xs p-2 border border-border/60 rounded-lg bg-card flex flex-col gap-1 transition-colors items-center hover:bg-muted/60">
                <Icon name="i-lucide:credit-card" class="text-blue-600 size-4" />
                <span class="text-[11px] font-medium">Cards</span>
              </button>
            </div>

            {/* Recent Activity */}
            <div class="pt-1 space-y-1.5">
              <div class="text-[10px] text-muted-foreground tracking-wider font-semibold uppercase">
                Recent Transactions
              </div>
              <div class="border border-border/60 rounded-lg bg-card overflow-hidden divide-border/40 divide-y">
                <For each={transactions}>
                  {(tx) => (
                    <div class="text-xs p-2 flex items-center justify-between">
                      <div>
                        <div class="font-medium">{tx.name}</div>
                        <div class="text-[10px] text-muted-foreground">{tx.type}</div>
                      </div>
                      <span
                        class={`font-semibold ${
                          tx.positive ? 'text-emerald-600 dark:text-emerald-400' : 'text-foreground'
                        }`}
                      >
                        {tx.amount}
                      </span>
                    </div>
                  )}
                </For>
              </div>
            </div>
          </div>
        </Sidebar.Inset>
      </Sidebar>
    </div>
  )
}
```

## API Reference

### Attributes

| Attributes | Slot | Description |
| --- | --- | --- |
| `data-mobile` | `sidebar`, `sidebar-panel`, `sidebar-menu-button`, `sidebar-menu-action` | Present on the mobile rendering path. |
| `data-side` | `sidebar`, `sidebar-panel` | Stores the resolved floating or drawer content side. |
| `data-splitter-root` | `sidebar` | Identifies the root container of a splitter layout. |
| `data-variant` | `sidebar`, `sidebar-panel` | Stores the resolved visual variant. |
| `data-closed` | `sidebar-panel`, `sidebar-rail`, `sidebar-trigger` | Present when disclosure or transition content is closed. |
| `data-expanded` | `sidebar-panel` | Present when the panel, accordion, or menu is expanded. |
| `data-resizing` | `sidebar-panel` | Present while resizable handles are actively dragging. |
| `data-active` | `sidebar-rail`, `sidebar-menu-button` | Present when the item or trigger is active. |
| `data-dragging` | `sidebar-rail` | Present while the related thumb or handle is being dragged. |
| `data-disabled` | `sidebar-menu-button`, `sidebar-trigger` | Present when the component, slot, or item is disabled. |
| `data-open` | `sidebar-trigger` | Present when the disclosure, popover, or overlay is open. |

### Props

#### Sidebar

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| breakpoint | number \| undefined | 768 | Max viewport width in pixels that counts as mobile.<br>Used as `(max-width: ${breakpoint}px)` when `mobile` is omitted. |
| defaultOpen | boolean \| 'desktop-only' \| undefined | — | Initial open state. Unlike `open`, which is a plain boolean for the active layout, this<br>accepts `'desktop-only'` because the sidebar remembers uncontrolled state per layout:<br>`true` opens both layouts, `'desktop-only'` opens only the desktop panel, and `false`<br>closes both. When omitted, the desktop panel starts expanded and the mobile drawer starts<br>closed. Ignored while `open` is controlled. |
| defaultWidth | number \| undefined | — | Initial desktop panel width in pixels for uncontrolled usage. Ignored while `width` is<br>controlled. When omitted, the recipe default width applies until the rail is resized. |
| maxWidth | number \| undefined | 480 | Maximum desktop panel width in pixels for `Sidebar.Rail` resizing. |
| minWidth | number \| undefined | 224 | Minimum desktop panel width in pixels for `Sidebar.Rail` resizing. |
| mobile | boolean \| undefined | — | Controlled mobile mode: `true` renders the panel in a drawer, `false` inline. When omitted,<br>a `matchMedia` query on `breakpoint` decides, and the server renders the desktop layout. |
| onOpenChange | ((open: boolean) => void) \| undefined | — | Called with the next open state for every user-driven change of the active layout: the<br>trigger, the rail, and Escape or overlay dismissal of the mobile drawer. Not called when<br>the layout switches. |
| onWidthChange | ((width: number) => void) \| undefined | — | Called with the new pixel width on every width change, including each step of a<br>`Sidebar.Rail` drag; use `onWidthCommit` to persist only the final value. |
| onWidthCommit | ((width: number) => void) \| undefined | — | Called once per completed interaction with the final pixel width:<br>at the end of a `Sidebar.Rail` drag that changed the width, and on<br>each keyboard width change. |
| open | boolean \| undefined | — | Controlled open state of the active layout: the desktop panel, or the mobile drawer when<br>the sidebar is mobile. Switching layouts does not write this value. |
| side | 'left' \| 'right' \| undefined | 'left' | Which viewport edge the sidebar attaches to. |
| translations | Translations \| undefined | — | Localized labels for this sidebar (`label` for the mobile drawer and `resize` for the rail<br>separator). Merged per key over the provider messages and English defaults. |
| variant | 'default' \| 'floating' \| 'inset' \| undefined | 'default' | Sidebar chrome variant: `default` sits inline, `floating` and `inset` lift it from the page. |
| width | number \| undefined | — | Controlled desktop panel width in pixels. When `undefined` the<br>`--mo-sidebar-width` custom property is left unset and the recipe<br>default (`var(--sidebar-width, clamp(14rem, 25%, 20rem))`) applies. |
| children | JSX.Element \| undefined | — | Content rendered inside the element. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| classes | Classes \| undefined | — | Family slot class defaults for this instance. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |
| styles | Styles \| undefined | — | Family slot style defaults for this instance. |

**`translations` example**

```tsx
import { Sidebar } from 'moraine'

<Sidebar translations={{ label: 'Navegación', resize: 'Cambiar tamaño' }}>
  <Sidebar.Panel />
  <Sidebar.Rail />
</Sidebar>
```

#### Sidebar.Panel

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| aria-label | string \| undefined | — | Accessible name of the panel: set on the desktop panel element and on the mobile drawer<br>content. In the mobile drawer, falls back to the `title` attribute, then to the localized<br>`label` message (English default `Sidebar navigation`). |
| id | string \| undefined | — | DOM `id` of the panel, referenced by `aria-controls` on `Sidebar.Trigger` and<br>`Sidebar.Rail`. A unique id is generated when omitted. |
| ref | Ref<T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T]: HTMLElement> \| undefined | — | Ref forwarded to the rendered element. |
| as | T \| undefined | 'aside' | Element or component to render as. |
| children | JSX.Element \| undefined | — | Content rendered inside the element. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.Rail

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| aria-label | string \| undefined | — | Accessible name for the resize separator.<br>Localized via MoraineProvider messages when omitted. English default is `Resize sidebar`. |
| disabled | boolean \| undefined | — | Disables pointer, keyboard, and click resizing. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.Header

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | T \| undefined | 'div' | Element or component to render as. |
| children | JSX.Element \| undefined | — | Content rendered inside the element. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.Content

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | T \| undefined | 'div' | Element or component to render as. |
| children | JSX.Element \| undefined | — | Content rendered inside the element. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.Footer

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | T \| undefined | 'div' | Element or component to render as. |
| children | JSX.Element \| undefined | — | Content rendered inside the element. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.Inset

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | T \| undefined | 'main' | Element or component to render as. |
| children | JSX.Element \| undefined | — | Content rendered inside the element. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.Trigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| disabled | boolean \| undefined | — | Whether this trigger is disabled. |
| ref | Ref<T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T]: HTMLElement> \| undefined | — | Ref forwarded to the rendered element. |
| as | T \| undefined | 'button' | Element or component to render as. A tag name (`'a'`) renders that element and narrows the<br>other props to its attributes; a Solid component receives the props the trigger would put on<br>its element, so it should spread them onto its root and forward `ref`. Own styles and state<br>attributes are kept. |
| children | JSX.Element \| undefined | — | Trigger label and visual content. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

**`as` example**

```tsx
import { Button } from 'moraine'

<Button as="a" href="/docs" target="_blank">Docs</Button>
```

#### Sidebar.Group

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | T \| undefined | 'div' | Element or component to render as. |
| children | JSX.Element \| undefined | — | Content rendered inside the element. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.GroupLabel

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | T \| undefined | 'div' | Element or component to render as. |
| children | JSX.Element \| undefined | — | Content rendered inside the element. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.Menu

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | T \| undefined | 'ul' | Element or component to render as. |
| children | JSX.Element \| undefined | — | `MenuItem` entries. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.MenuItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | T \| undefined | 'li' | Element or component to render as. |
| children | JSX.Element \| undefined | — | A `MenuButton` with an optional `MenuAction`, or a `MenuSub`. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.MenuButton

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| active | boolean \| undefined | — | Whether the button is highlighted as the current item. On a link (`href` set or rendered as<br>`<a>`) it also sets `aria-current="page"` unless you pass your own `aria-current`. |
| closeOnSelect | boolean \| undefined | — | Whether activating this button on mobile closes the drawer. Has no effect on desktop, when<br>the button is disabled, or when the click handler calls `preventDefault()`; modified and<br>non-primary clicks never close it. When omitted, buttons with `href` close the drawer and<br>others stay open. |
| disabled | boolean \| undefined | — | Whether this trigger is disabled. |
| href | string \| undefined | — | Link target. Makes the button render as an `<a>` (unless `as` picks another element or<br>component, which still receives `href`). A disabled `<a>` has its `href` removed. |
| leading | IconT.Name \| undefined | — | Icon rendered before the label. |
| ref | Ref<T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T]: HTMLElement> \| undefined | — | Ref forwarded to the rendered element. |
| trailing | IconT.Name \| undefined | — | Icon rendered after the label. |
| as | T \| undefined | 'button' | Element or component to render as. A tag name (`'a'`) renders that element and narrows the<br>other props to its attributes; a Solid component receives the props the trigger would put on<br>its element, so it should spread them onto its root and forward `ref`. Own styles and state<br>attributes are kept. |
| children | JSX.Element \| undefined | — | Trigger label and visual content. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

**`as` example**

```tsx
import { Button } from 'moraine'

<Button as="a" href="/docs" target="_blank">Docs</Button>
```

#### Sidebar.MenuAction

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | T \| undefined | 'div' | Element or component to render as. |
| children | JSX.Element \| undefined | — | Controls placed over the end of the enclosing `MenuItem`'s first row, such as a dropdown<br>menu trigger. The `MenuButton` stays highlighted while the pointer is over these controls. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.MenuSub

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| defaultOpen | boolean \| undefined | false | Initial expanded state when uncontrolled. |
| disabled | boolean \| undefined | false | Whether the trigger is disabled. |
| forceMount | boolean \| undefined | false | Whether closed content stays mounted. When `false`, content mounts on first open and<br>unmounts once it closes; when `true`, content mounts even before the first open. |
| onOpenChange | ((open: boolean) => void) \| undefined | — | Callback invoked when the expanded state changes. |
| open | boolean \| undefined | — | Controlled expanded state. |
| transition | boolean \| undefined | false | Whether to animate the content height. |
| children | JSX.Element \| undefined | — | A `MenuSubTrigger` followed by a `MenuSubContent`. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

#### Sidebar.MenuSubTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| disabled | boolean \| undefined | — | Whether this trigger is disabled. |
| leading | IconT.Name \| undefined | — | Icon rendered before the label. |
| ref | Ref<T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T]: HTMLElement> \| undefined | — | Ref forwarded to the rendered element. |
| trailing | IconT.Name \| undefined | 'i-lucide:chevron-right' | Disclosure icon that rotates while expanded. |
| as | T \| undefined | 'button' | Element or component to render as. A tag name (`'a'`) renders that element and narrows the<br>other props to its attributes; a Solid component receives the props the trigger would put on<br>its element, so it should spread them onto its root and forward `ref`. Own styles and state<br>attributes are kept. |
| children | JSX.Element \| undefined | — | Trigger label and visual content. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |

**`as` example**

```tsx
import { Button } from 'moraine'

<Button as="a" href="/docs" target="_blank">Docs</Button>
```

#### Sidebar.MenuSubContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| as | T \| undefined | 'ul' | Element or component to render as. |
| children | JSX.Element \| undefined | — | Nested `MenuItem` entries. |
| class | SlotClassValue \| undefined | — | Class applied to the component root or trigger element. |
| style | SlotStyleValue \| undefined | — | Style applied to the component root or trigger element. |
