# Sidebar (Lumen Halo): prompt.md (v1.0.0)

- id: `lumen-sidebar` · version 1.0.0 · component · pro (All-Access)
- category: Navigation
- build: Base UI (this item also ships a Radix build)
- install (this build): `npx shadcn@latest add @beautiful-ui-pro/lumen-sidebar`
- npm dependencies: @base-ui/react@^1, class-variance-authority@^0.7
- registry dependencies: utils, @beautiful-ui/lumen-button, @beautiful-ui/lumen-input, @beautiful-ui/lumen-separator, @beautiful-ui-pro/lumen-sheet, @beautiful-ui/lumen-skeleton, @beautiful-ui/lumen-tooltip, https://beautiful-ui.dev/r/lumen-foundation.json
- docs: https://beautiful-ui.dev/components/lumen-sidebar
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

shadcn's Sidebar, cut from Lumen glass: a smoked-glass panel where a lens glides to the active page and lights a filament on its edge, sub-pages light their stretch of the guide line, and the rail glows as you reach for it. Collapses off-canvas or to icons with tooltips, becomes a sheet on phones, remembers its state and toggles on ⌘B.

## Build it
- Stack: React 19 (`ref` is a plain prop), TypeScript, Tailwind CSS v4 utilities, a shadcn-initialised project with the `@/*` alias.
- Packages: `@base-ui/react@^1`, `class-variance-authority@^0.7` (Base UI build); `class-variance-authority@^0.7`, `radix-ui@^1` (Radix build).
- Files: `components/ui/lumen/sidebar.tsx`; shared code: `lib/beautiful-ui/lumen/indicator.ts`, `lib/beautiful-ui/lumen/use-mobile.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `lumen-button`, `lumen-input`, `lumen-separator`, `lumen-sheet`, `lumen-skeleton`, `lumen-tooltip`, `lumen-foundation`.
- Builds: separate Base UI and Radix files. Install the one that matches the project (see Install): a free item's bare URL installs the Base UI build of it and its dependencies.
- Exports to keep: `SidebarProvider / useSidebar`, `Sidebar`, `SidebarHeader / SidebarContent / SidebarFooter`, `SidebarGroup / SidebarGroupLabel / SidebarGroupAction / SidebarGroupContent`, `SidebarMenu / SidebarMenuItem / SidebarMenuButton / SidebarMenuAction / SidebarMenuBadge / SidebarMenuSkeleton`, `SidebarMenuSub / SidebarMenuSubItem / SidebarMenuSubButton`, `SidebarTrigger / SidebarRail / SidebarInset / SidebarInput / SidebarSeparator`, and every exported type.
- CSS: the install merges this item's rules (the registry `css` field) into your global stylesheet, in `@layer components`, and adds the lumen foundation (tokens, keyframes, motion levels) once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Tokens: retheme with the `--lumen-*` custom properties (`--lumen-accent`, `--lumen-accent-text`, `--lumen-bad`, `--lumen-bad-text`, `--lumen-focus`, `--lumen-good`, `--lumen-good-text`, `--lumen-hairline`, `--lumen-ink`, `--lumen-muted-ink`, `--lumen-series-1`, `--lumen-series-2`, `--lumen-series-3`, `--lumen-series-4`, `--lumen-series-5`, `--lumen-series-6`, `--lumen-warn`, `--lumen-warn-text`); this item's CSS also reads `--lumen-font-mono`, `--lumen-font-sans`, `--lumen-radius-k`, `--lumen-sidebar-height`. Never add Tailwind colour classes inside the component.

```tsx
import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider, SidebarTrigger } from "@/components/ui/lumen/sidebar";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `SidebarProvider / useSidebar` | `sidebar-wrapper` | State, cookie and ⌘B. |
| `Sidebar` | `sidebar` | The panel (desktop) or sheet (phone). |
| `SidebarHeader / SidebarContent / SidebarFooter` | `sidebar-content` | Regions. |
| `SidebarGroup / SidebarGroupLabel / SidebarGroupAction / SidebarGroupContent` | `sidebar-group` | Sections. |
| `SidebarMenu / SidebarMenuItem / SidebarMenuButton / SidebarMenuAction / SidebarMenuBadge / SidebarMenuSkeleton` | `sidebar-menu` | Pages, with the lens. |
| `SidebarMenuSub / SidebarMenuSubItem / SidebarMenuSubButton` | `sidebar-menu-sub` | Sub-pages on the guide line. |
| `SidebarTrigger / SidebarRail / SidebarInset / SidebarInput / SidebarSeparator` | `sidebar-trigger` | Toggle, edge, page and extras. |

Style a part with `[data-slot="<slot>"]` selectors or its `className`; keep the attributes when editing.

## Sound
- Keep every `data-slot` and `data-sound` attribute: the sound layer reads them.
- Installing this item adds no audio. Nothing plays until the app mounts `GlassSoundProvider` once (install: `npx shadcn@latest add https://beautiful-ui.dev/r/glass-sound.json`, import from `@/components/beautiful-ui/glass-sound`); `GlassSoundToggle` is its mute control. Without a provider the audio engine never loads.

## Match the original
- Read `components/ui/lumen/sidebar.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when
- sidebar, app sidebar, side navigation, nav rail, collapsible sidebar, dashboard layout, app shell, shadcn sidebar, Lumen
- The main navigation of an app or dashboard
- Anything shaped like shadcn's sidebar blocks: groups, sub-pages, a workspace switcher, a user menu

### Not when
- A marketing site's navigation: use Navigation Menu
- A drop-in, data-driven nav with a phone layout already designed: use App Sidebar

## Mistakes
- Wrap the app in TooltipProvider so collapsed tooltips work
- Give every button an icon when using collapsible="icon"
- Read the sidebar_state cookie on the server for defaultOpen to avoid a flash

## Usage

```tsx
import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarProvider, SidebarTrigger } from "@/components/ui/lumen/sidebar";

<SidebarProvider>
  <Sidebar collapsible="icon" variant="floating">
    <SidebarContent>
      <SidebarGroup>
        <SidebarGroupLabel>Workspace</SidebarGroupLabel>
        <SidebarMenu>
          <SidebarMenuItem>
            <SidebarMenuButton isActive tooltip="Overview"><GridIcon /><span>Overview</span></SidebarMenuButton>
          </SidebarMenuItem>
        </SidebarMenu>
      </SidebarGroup>
    </SidebarContent>
  </Sidebar>
  <SidebarInset>
    <header><SidebarTrigger /></header>
  </SidebarInset>
</SidebarProvider>
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `defaultOpen / open / onOpenChange (SidebarProvider)` | `boolean` | `true` | Expanded or collapsed; saved in the sidebar_state cookie. |
| `side` | `"left" \| "right"` | `"left"` | Which edge. |
| `variant` | `"sidebar" \| "floating" \| "inset"` | `"sidebar"` | Flush panel, floating glass, or the page inset as a card. |
| `collapsible` | `"offcanvas" \| "icon" \| "none"` | `"offcanvas"` | Slide away, shrink to icons, or stay. |
| `isActive / tooltip / size (SidebarMenuButton)` | `boolean / string \| TooltipContent props / "default" \| "sm" \| "lg"` |  | The lit page; the tooltip shown when collapsed to icons. |
| `showOnHover (SidebarMenuAction)` | `boolean` | `false` | Reveal the item's action on hover or focus. |

Full docs: https://beautiful-ui.dev/components/lumen-sidebar

## Customising
- Colours: set the `--lumen-*` tokens on `:root`, or on a container with the `lumen-scope` class to retheme one area. Add the `lumen-inherit` class to follow your shadcn palette instead (`--chart-N`, `--destructive`).
- Dark mode follows the `.dark` class on an ancestor (the shadcn and next-themes convention).
- Update later by re-running the install with `--overwrite` (review the diff if you edited it). Changelog: https://beautiful-ui.dev/r/changelog.json

## Keyboard

| Keys | Action |
|---|---|
| ⌘B / Ctrl+B | Collapse or expand |
| Tab | Through the buttons and actions |
| Escape | Close the phone sheet |

## Motion inventory

| Interaction | What moves |
|---|---|
| Active page | The lens glides to it; its filament stays lit |
| Collapse | Width eases to icons; labels fade |
| Rail | A filament grows along the edge on hover |

## Accessibility contract (preserve when editing)
- Menus are lists of buttons or links; mark the current page with isActive (and aria-current on links)
- Collapsed to icons, every button keeps a tooltip and an accessible name
- On phones it is a modal sheet with a screen-reader title

## Install

```bash
npx shadcn@latest add @beautiful-ui-pro/lumen-sidebar
```

Pro item: needs the `@beautiful-ui-pro` registry in `components.json` and `BEAUTIFUL_UI_TOKEN` in `.env.local` (https://beautiful-ui.dev/account). Setup: https://beautiful-ui.dev/docs/pro. Your components.json `style` picks the build: radix-*, new-york and default get Radix, base-* gets Base UI.

## Credits
- Built on shadcn/ui (https://ui.shadcn.com)

The lumen foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://beautiful-ui.dev/r/lumen-foundation.json.
