# Site Header (Notchset): prompt.md (v1.0.0)

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

A marketing site's header on the navbar's trace: each item has a target node and stem, and a pulse travels the trace to the new page's node; mega panels with products and a live preview of your own or link columns with a featured card; simple and centered layouts; the bar shrinks once the page scrolls and folds into a MENU sheet on phones.

## Build it
- Stack: React 19 (`ref` is a plain prop), TypeScript, Tailwind CSS v4 utilities, a shadcn-initialised project with the `@/*` alias.
- Packages: `class-variance-authority@^0.7`.
- Files: `components/ui/notchset/blocks/site-header.tsx`; shared code: `lib/beautiful-ui/notchset/instrument.tsx`, `lib/beautiful-ui/notchset/root.ts`, `lib/beautiful-ui/notchset/button-variants.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `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: `SiteHeader`, 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 { SiteHeader } from "@/components/ui/notchset/blocks/site-header";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `SiteHeader` | `site-header` | The header, its panels and the phone sheet. |

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/site-header.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
- header, navbar, site header, mega menu, marketing nav, top navigation, sticky header, Notchset
- The top of a marketing or docs site
- A product with several areas worth showing before the click

### Not when
- Inside an app: use the App Shell
- A one-page site with a single action: a plain bar reads faster

## Mistakes
- Map sub-pages to their parent item in current, or the trace points nowhere
- Keep previews light: they mount when an item is hovered

## Usage

```tsx
import { SiteHeader } from "@/components/ui/notchset/blocks/site-header";

export function Header({ page }: { page: string }) {
  return (
    <SiteHeader
      brand={{ name: "Relay", href: "/" }}
      items={[
        {
          id: "product",
          label: "Product",
          menu: {
            kind: "products",
            heading: "THE PLATFORM",
            items: [{ id: "traces", tile: "TR", name: "Traces", description: "Every step of every run.", href: "/traces" }],
          },
        },
        { id: "pricing", label: "Pricing", href: "/pricing" },
      ]}
      current={page}
      signIn={{ label: "Sign in", href: "/login" }}
      primary={{ label: "START FREE", href: "/signup" }}
    />
  );
}
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `variant` | `"mega" \| "simple" \| "centered"` |  | Mega opens panels; simple is links only; centered puts the logo in the middle. |
| `items` | `{ id, label, href?, menu? }[]` |  | menu is { kind: 'products', heading, items: { id, tile, name, description, href, preview? }[] } or { kind: 'columns', columns, featured? }. |
| `current / onNavigate` | `string / (id) => void` |  | The current page's item; changing it sends the pulse along the trace. |
| `brand / signIn / primary` | `{ name, href, mark? } / { label, href } / { label, href?, onPress?, workingLabel? }` |  | The logo, the quiet sign-in and the primary key (onPress shows the scanner until it settles). |
| `scrollRoot` | `RefObject<HTMLElement>` |  | What scrolls, if not the window (the bar shrinks past 12px). |

Full docs: https://beautiful-ui.dev/components/site-header

## 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 |
|---|---|
| Enter / Space | Open or close a menu |
| ↓ | Open the menu and move into it |
| Esc | Close the menu or sheet, back to its trigger |

## Performance

- Node centres are measured once and on resize; previews mount only while shown.

## Responsive

- Under 760px (container width) the nav folds into the MENU sheet; sign-in hides under 480px.

## Motion inventory

| Interaction | What moves |
|---|---|
| Page change | A pulse travels the trace to the new node and a segment draws behind it (440ms trace); the node's dot and stem grow |
| Menus | Open after 90ms of hover, close 180ms after leaving; panels unroll (420ms) and roll up (260ms); switching panes slides them 24px |
| Scroll | The bar shrinks from 64px to 52px past 12px of scroll (260ms) and its rule turns ink |
| Primary | The scanner while onPress runs |

## Accessibility contract (preserve when editing)
- The nav is named Main; the current page has aria-current=page
- Menu triggers are buttons with aria-expanded and aria-controls; panels are named regions, inert while closed
- ↓ on a trigger opens its panel and focuses its first link; Esc closes and returns focus to the trigger
- On phones the same links sit in a MENU sheet (a button with aria-expanded)

## Install

```bash
npx shadcn@latest add @beautiful-ui-pro/site-header
```

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.
