# App Shell (Notchset): prompt.md (v1.0.0)

- id: `app-shell` · version 1.0.0 · block · pro (Pro)
- category: App screens
- build: Base UI (one set of files; its dependencies follow the build)
- install (this build): `npx shadcn@latest add @beautiful-ui-pro/app-shell`
- npm dependencies: none
- registry dependencies: utils, @beautiful-ui/segmented-control, https://beautiful-ui.dev/r/notchset-foundation.json
- docs: https://beautiful-ui.dev/components/app-shell
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

A workspace shell that shows agent health without opening anything: a sidebar with a workspace switcher, environment, live agent status and a user menu, a rail at ⌘\, Jump to at ⌘K, toasts, and page parts for KPIs and ruled lists.

## Build it
- Stack: React 19 (`ref` is a plain prop), TypeScript, Tailwind CSS v4 utilities, a shadcn-initialised project with the `@/*` alias.
- Packages: none beyond React.
- Files: `components/ui/notchset/blocks/app-shell.tsx`; shared code: `lib/beautiful-ui/notchset/blocks.tsx`, `lib/beautiful-ui/notchset/instrument.tsx`, `lib/beautiful-ui/notchset/root.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `segmented-control`, `notchset-foundation`.
- Builds: one set of files for both, but its dependencies come in Base UI and Radix builds. 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: `AppShell`, `ShellKpis`, `ShellPage`, `ShellRow`, `ShellSection`, `ShellStatusNode`, `ShellSwitch`, `useShellToast`, and every exported type.
- CSS: the install adds the notchset foundation (tokens, keyframes, motion levels) to your global stylesheet 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 `--notchset-*` custom properties (`--notchset-check`, `--notchset-control-edge`, `--notchset-draw-from`, `--notchset-ease-bloom`, `--notchset-ease-glide`, `--notchset-ease-key-down`, `--notchset-ease-key-up`, `--notchset-ease-travel`, `--notchset-fade`, `--notchset-focus-color`, `--notchset-focus-inset`, `--notchset-grow-to`, `--notchset-key-down`, `--notchset-key-up`, `--notchset-life-from`, `--notchset-life-ms`, `--notchset-node-blink`, `--notchset-node-bloom`, `--notchset-node-delay`, `--notchset-plate-color`, `--notchset-rise-from`, `--notchset-rule`, `--notchset-scan-to`, `--notchset-scroll`, `--notchset-signal`, `--notchset-sweep-to`, `--notchset-travel`). Never add Tailwind colour classes inside the component.

```tsx
import { AppShell, ShellPage } from "@/components/ui/notchset/blocks/app-shell";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `AppShell` | `app-shell` | The shell: sidebar, header, Jump to and toasts. |
| `ShellPage` | `shell-page` | A page head: status line, condensed title, description. |
| `ShellKpis` | — | A strip of rolling KPIs. |
| `ShellSection` | — | A labelled ruled list. |
| `ShellRow` | — | A clickable ruled row on your grid. |
| `ShellSwitch` | — | A settings switch with a stretch thumb. |
| `ShellStatusNode` | — | Live, paused or degraded. |

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 `SoundProvider` once (install: `npx shadcn@latest add https://beautiful-ui.dev/r/notchset-sound.json`, import from `@/components/ui/notchset/sound-provider`); `useSound()` gives `muted` and `setMuted` for a mute control. Without a provider the audio engine never loads.

## Match the original
- Read `components/ui/notchset/blocks/app-shell.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
- app shell, sidebar layout, dashboard layout, workspace switcher, collapsible sidebar, admin layout, agent status sidebar, Notchset
- The frame of a product with several areas, especially one that runs agents or jobs whose health matters at a glance

### Not when
- A marketing site: use Site Header
- A single page with no navigation

## Mistakes
- Give every nav item a page: the reference has no decorative buttons, and neither should yours
- Wrap pages that call useShellToast inside AppShell: the hook reads the shell's context

## Usage

```tsx
"use client";

import * as React from "react";
import { AppShell, ShellPage } from "@/components/ui/notchset/blocks/app-shell";

export function Workspace() {
  const [page, setPage] = React.useState("home");
  return (
    <AppShell
      workspaces={[{ id: "acme", initials: "AL", name: "Acme Labs", plan: "TEAM PLAN" }]}
      workspace="acme"
      nav={[
        { items: [{ id: "home", label: "Home", icon: "home" }] },
        { label: "AGENTS", items: [{ id: "planner", label: "Planner", status: "live", meta: "148/MIN" }] },
      ]}
      active={page}
      onNavigate={setPage}
      breadcrumb={`ACME LABS / ${page.toUpperCase()}`}
      user={{ name: "Maya Kerr", initials: "MK", email: "maya@acme.dev", status: "OWNER · ONLINE" }}
      userMenu={[{ id: "out", label: "Sign out", tone: "signal", onSelect: () => "SIGNED OUT" }]}
    >
      <ShellPage title={page} description="Every agent in this workspace." />
    </AppShell>
  );
}
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `workspaces / workspace / onWorkspaceChange` | `{ id, initials, name, plan }[]` |  | The switcher's menu; switching confirms in a toast. |
| `environments / environment / onEnvironmentChange` | `{ value, label }[]` |  | Optional PROD / STAGING control under the switcher. |
| `nav` | `{ label?, items: { id, label, icon?, status?, meta? }[] }[]` |  | Sections; icon is home, inbox, runs, doc, settings or a node; status (live, paused, degraded) draws the agent node. |
| `active / onNavigate` | `string` |  | The current page; Jump to and the nav both call onNavigate. |
| `breadcrumb` | `string` |  | The header's path. |
| `user / userMenu` | `{ name, initials, email, status?, away? } / { id, label, shortcut?, tone?, onSelect? }[]` |  | The user row and its menu; return a string from onSelect to confirm it in the toast. |
| `jumpItems` | `{ id, label, kind }[]` |  | What Jump to searches; every nav item by default. |
| `collapsed / defaultCollapsed / onCollapsedChange` | `boolean` | `false` | The rail (⌘\). Under 640px the sidebar stays a rail. |
| `children` | `ReactNode` |  | The page: compose it from ShellPage, ShellKpis, ShellSection, ShellRow and ShellSwitch, or your own. |

Full docs: https://beautiful-ui.dev/components/app-shell

## Customising
- Colours: the component reads your shadcn tokens (`--background`, `--foreground`, `--border` …), refined by the `--notchset-*` tokens. The signal colour is `--notchset-signal` (it falls back to `--destructive`). Set tokens on `:root`, or on any container to retheme one area.
- 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 |
|---|---|
| ⌘\ / Ctrl+\ | Collapse or expand the sidebar |
| ⌘K / Ctrl+K | Jump to |
| ↑ ↓ Home End | Move in a menu or Jump to |
| Enter / Esc | Open / close |

## Performance

- Plain DOM; one ResizeObserver for the rail breakpoint. Nothing animates per frame except a degraded node's pulse.

## Responsive

- Under 640px the sidebar stays a 58px rail; KPI strips go one per row under 520px of page width.

## Motion inventory

| Interaction | What moves |
|---|---|
| Sidebar | Collapses to a 58px rail (380ms glide); labels fade (160ms) |
| Active item | Its 2px bar grows from the centre (300ms) |
| Menus | Unroll on grid rows (320ms), roll up faster (180ms) |
| Pages | Each page rises in (260ms); KPI values roll, 60ms apart |
| Degraded agent | Its signal node pulses (1400ms) |

## Accessibility contract (preserve when editing)
- The sidebar is a nav; the active item has aria-current=page; agent status is spoken, not only drawn
- The workspace and user menus are menus (menuitemradio for workspaces) with arrow keys; Esc closes them and returns focus to their button, and a press outside closes them
- Jump to is a modal dialog (Tab stays inside, the shell behind is inert) with a combobox over a listbox (aria-activedescendant); Esc or a pick closes it and returns focus to its button
- Toasts are announced (role=status); KPI values keep their plain text for screen readers

## Install

```bash
npx shadcn@latest add @beautiful-ui-pro/app-shell
```

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 notchset 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/notchset-foundation.json.
