# Notch (Notchset): prompt.md (v2.0.0)

- id: `notch` · version 2.0.0 · block · pro (Pro)
- category: AI and agents
- build: one set of files for every shadcn style
- install: `npx shadcn@latest add @notchset-pro/notch`
- npm dependencies: lucide-react@^1
- registry dependencies: utils, https://notchset.dev/r/notchset-foundation.json, @notchset/button, @notchset/live-label, @notchset/popover, @notchset/rolling-clock, @notchset/status-glyph-run, @notchset/stream-adapters, @notchset/tool-row
- docs: https://notchset.dev/blocks/notch
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

A rail set into the header where every agent run, send and timer is a segment showing its state, so the queue reads at rest. The one that speaks lifts out: a phase change peeks its words, a gate holds its card open with the exact action, a send keeps Undo. On a phone it floats as a pill at the foot..

## Build it
- Stack: React 18.3 or 19, TypeScript, Tailwind CSS v4 utility classes on the foundation's roles, a components.json (imports use its aliases).
- Packages: `lucide-react@^1` beyond `react` and `react-dom`.
- Files: `components/ui/notchset/blocks/notch.tsx`, `components/ui/notchset/disclosure-parts.tsx`, `components/ui/notchset/key-cap-parts.tsx`, `components/ui/notchset/run-pill-parts.tsx`; shared code: `lib/notchset/announce.ts`, `lib/notchset/controllable.ts`, `lib/notchset/feedback.ts`, `lib/notchset/icons.ts`, `lib/notchset/media.ts`, `lib/notchset/words.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `notchset-foundation`, `button`, `live-label`, `popover`, `rolling-clock`, `status-glyph-run`, `stream-adapters`, `tool-row`.
- Builds: one set of files, the same for every shadcn style.
- Exports to keep: `NOTCH_LABELS`, `Notch`, `notchPriority`, `DisclosureScope`, `disclosureScope`, `disclosureTrigger`, `partId`, `useDisclosure`, `asCtrl`, `capsOf`, `hintProps`, `isApple`, `KEY_CAP_LABELS`, `keyCap`, `keyCapTone`, `KeyCaps`, `RUN_PILL_LABELS`, `RunPill`, and every exported type.
- CSS: the install adds the notchset foundation (its roles, keyframes and motion switch, reading your shadcn tokens for colour) 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.
- Colours: every part reads the foundation's roles (`--ns-canvas`, `--ns-ink`, `--ns-line`, `--ns-signal` …), which read your shadcn tokens (`--background`, `--foreground`, `--border`, `--destructive` …), plus the optional `--success` and `--warning`. Retheme on `:root` or any container; never add Tailwind colour classes inside the component.
- This item reads `--ns-bad`, `--ns-bezel`, `--ns-btn-ok`, `--ns-canvas`, `--ns-corner`, `--ns-depth-lift`, `--ns-ease`, `--ns-ease-arrive`, `--ns-ease-move`, `--ns-ease-panel`, `--ns-ease-pop`, `--ns-ease-press`, `--ns-ease-spring`, `--ns-font-body`, `--ns-font-mono`, `--ns-hover`, `--ns-ink`, `--ns-ink-2`, `--ns-ink-3`, `--ns-line`, `--ns-line-soft`, `--ns-ok`, `--ns-panel`, `--ns-play-open`, `--ns-radius-control`, `--ns-radius-control-sm`, `--ns-radius-full`, `--ns-radius-lg`, `--ns-radius-xs`, `--ns-raised`, `--ns-shadow-float`, `--ns-signal`, `--ns-text-body`, `--ns-text-meta`, `--ns-text-small`, `--ns-time-color`, `--ns-time-dialog`, `--ns-time-menu`, `--ns-time-page`, `--ns-time-panel`, `--ns-time-quick`, `--ns-time-spring`, `--ns-warn`, `--ns-weight-medium`, `--ns-well`.
- Retune it (on any ancestor) with the foundation's roles and hooks: `--ns-agent-b`, `--ns-agent-c`, `--ns-agent-d`, `--ns-agent-drift`, `--ns-agent-fill`, `--ns-agent-h1`, `--ns-agent-h2`, `--ns-agent-h3`, `--ns-agent-shift`, `--ns-avatar-card`, `--ns-avatar-lg`, `--ns-avatar-md`, `--ns-avatar-sm`, `--ns-avatar-xs`, `--ns-bad`, `--ns-bad-ink`, `--ns-band`, `--ns-band-edge`, `--ns-band-grade`, `--ns-band-optimal`, `--ns-banner-beat`, `--ns-banner-radius`, `--ns-beat`, `--ns-beat-ease`, `--ns-bezel`, `--ns-bloom-close`, `--ns-bloom-open`, `--ns-bloom-rise`, `--ns-btn-bad`, `--ns-btn-bad-hover`, `--ns-btn-bad-line`, `--ns-btn-bezel`, `--ns-btn-chosen`, `--ns-btn-gone`, `--ns-btn-morph`, `--ns-btn-ok`, `--ns-btn-press`, `--ns-btn-release`, `--ns-btn-result`, `--ns-btn-roll`, `--ns-btn-stagger`, `--ns-btn-stagger-step`, `--ns-btn-tick`, `--ns-btn-tonal`, `--ns-btn-tonal-edge`, `--ns-btn-tonal-hover`, `--ns-bulk-clear`, `--ns-button`, `--ns-button-field-inset`, `--ns-button-lg`, `--ns-button-sm`, `--ns-canvas`, `--ns-card-tilt`, `--ns-cat-1`, `--ns-cat-2`, `--ns-cat-3`, `--ns-cat-4`, `--ns-cat-5`, `--ns-cat-6`, `--ns-check`, `--ns-check-round`, `--ns-cheer-1`, `--ns-cheer-2`, `--ns-cheer-3`, `--ns-cheer-edge`, `--ns-cheer-fold`, `--ns-cheer-glow`, `--ns-cheer-lift`, `--ns-chip`, `--ns-chip-pick`, `--ns-control`, `--ns-control-lg`, `--ns-control-pad`, `--ns-control-sm`, `--ns-corner`, `--ns-danger`, `--ns-deep`, `--ns-deep-ink`, `--ns-deep-ink-2`, `--ns-deep-line`, `--ns-depth-card`, `--ns-depth-lift`, `--ns-depth-surface`, `--ns-dialog`, `--ns-dialog-grow`, `--ns-dialog-lg`, `--ns-dialog-max`, `--ns-dialog-shrink`, `--ns-dialog-sm`, `--ns-dialog-top`, `--ns-dock-bottom`, `--ns-drop`, `--ns-ease`, `--ns-ease-arrive`, `--ns-ease-breathe`, `--ns-ease-drum`, `--ns-ease-exit`, `--ns-ease-fling`, `--ns-ease-glide`, `--ns-ease-grow`, `--ns-ease-move`, `--ns-ease-panel`, `--ns-ease-pop`, `--ns-ease-press`, `--ns-ease-spring`, `--ns-ebg-arm`, `--ns-ebg-lit`, `--ns-emoji`, `--ns-emoji-md`, `--ns-emoji-sm`, `--ns-field`, `--ns-field-edge`, `--ns-field-h`, `--ns-fill`, `--ns-fill-time`, `--ns-flood-arc`, `--ns-flood-aurora`, `--ns-flood-behind-1`, `--ns-flood-behind-2`, `--ns-flood-bloom`, `--ns-flood-deep`, `--ns-flood-dial-bloom`, `--ns-flood-glass`, `--ns-flood-grain`, `--ns-flood-image`, `--ns-flood-ink`, `--ns-flood-ink-low`, `--ns-flood-light`, `--ns-flood-mid`, `--ns-flood-pale`, `--ns-flood-pane`, `--ns-flood-pane-edge`, `--ns-flood-pill-ink`, `--ns-flood-ribbon`, `--ns-flood-ribbon-core`, `--ns-flood-shadow`, `--ns-flood-sheen`, `--ns-flood-wash`, `--ns-font-body`, `--ns-font-display`, `--ns-font-mono`, `--ns-font-script`, `--ns-glass`, `--ns-glass-blur`, `--ns-glass-shadow`, `--ns-glow`, `--ns-glyph-pad`, `--ns-grain`, `--ns-gutter`, `--ns-header`, `--ns-help-max`, `--ns-hit`, `--ns-hover`, `--ns-icon`, `--ns-icon-lg`, `--ns-icon-sm`, `--ns-icon-stroke`, `--ns-info`, `--ns-info-ink`, `--ns-ink`, `--ns-ink-2`, `--ns-ink-3`, `--ns-ink-4`, `--ns-layer-bar`, `--ns-layer-modal`, `--ns-layer-panel`, `--ns-layer-popup`, `--ns-layer-sticky`, `--ns-layer-tip`, `--ns-layer-toast`, `--ns-layer-zoom`, `--ns-lead-body`, `--ns-lead-figure`, `--ns-lead-large`, `--ns-lead-meta`, `--ns-lead-small`, `--ns-lead-sub`, `--ns-lead-title`, `--ns-leading`, `--ns-leading-prose`, `--ns-leading-title`, `--ns-lift`, `--ns-light-1`, `--ns-light-2`, `--ns-light-3`, `--ns-light-spread`, `--ns-light-strength`, `--ns-line`, `--ns-line-soft`, `--ns-lit-edge`, `--ns-map-grass`, `--ns-map-water`, `--ns-mark-edge`, `--ns-mark-lifted`, `--ns-mark-rest`, `--ns-mark-swap`, `--ns-marker`, `--ns-marker-ink`, `--ns-mc-place`, `--ns-mc-roll`, `--ns-measure`, `--ns-menu-dy`, `--ns-menu-lit`, `--ns-menu-pad`, `--ns-menu-row`, `--ns-menu-rule`, `--ns-mesh`, `--ns-mesh-frost`, `--ns-nest-inset`, `--ns-nest-outer`, `--ns-nest-r`, `--ns-notch-ease`, `--ns-ok`, `--ns-ok-ink`, `--ns-on-fill`, `--ns-orb-body`, `--ns-orb-cool`, `--ns-orb-core`, `--ns-orb-dawn`, `--ns-orb-deep`, `--ns-orb-edge`, `--ns-orb-grain`, `--ns-orb-ground`, `--ns-orb-halo`, `--ns-orb-inner`, `--ns-orb-key`, `--ns-orb-lift`, `--ns-orb-limb`, `--ns-orb-limb-from`, `--ns-orb-rim`, `--ns-orb-skin-hi`, `--ns-orb-skin-lo`, `--ns-orb-skin-mid`, `--ns-orb-warm`, `--ns-palette-min`, `--ns-panel`, `--ns-panel-room`, `--ns-panel-w`, `--ns-panel-w-lg`, `--ns-pick-slot`, `--ns-pill-prop`, `--ns-play-fill`, `--ns-play-fill-color`, `--ns-play-lift`, `--ns-play-lift-y`, `--ns-play-open`, `--ns-play-open-content`, `--ns-play-press`, `--ns-play-press-box`, `--ns-play-reduced`, `--ns-play-ring`, `--ns-play-roll`, `--ns-play-shake`, `--ns-play-spring`, `--ns-play-swap`, `--ns-play-swap-blur`, `--ns-press-min`, `--ns-press-scale`, `--ns-press-x`, `--ns-press-y`, `--ns-primary-hover`, `--ns-primary-press`, `--ns-prism-edge`, `--ns-prism-glint`, `--ns-prism-sheen`, `--ns-prism-tint`, `--ns-pulse`, `--ns-radius`, `--ns-radius-2xl`, `--ns-radius-button`, `--ns-radius-button-lg`, `--ns-radius-button-sm`, `--ns-radius-card`, `--ns-radius-check`, `--ns-radius-control`, `--ns-radius-control-sm`, `--ns-radius-float`, `--ns-radius-full`, `--ns-radius-lg`, `--ns-radius-mark`, `--ns-radius-menu-row`, `--ns-radius-modal`, `--ns-radius-pill`, `--ns-radius-sm`, `--ns-radius-xl`, `--ns-radius-xs`, `--ns-raised`, `--ns-ramp-1`, `--ns-ramp-2`, `--ns-ramp-3`, `--ns-ramp-4`, `--ns-ramp-5`, `--ns-ramp-shine`, `--ns-range`, `--ns-rest-1`, `--ns-rest-2`, `--ns-rest-3`, `--ns-rise`, `--ns-row`, `--ns-row-compact`, `--ns-row-hue`, `--ns-scrim`, `--ns-search-h`, `--ns-segment`, `--ns-segment-inset`, `--ns-segment-lift`, `--ns-segment-sm`, `--ns-selected`, `--ns-series`, `--ns-series-core`, `--ns-series-glint`, `--ns-series-tint`, `--ns-shadow-dialog`, `--ns-shadow-float`, `--ns-shadow-lift`, `--ns-shadow-panel`, `--ns-sheet`, `--ns-sheet-back`, `--ns-sheet-bottom`, `--ns-sheet-drop`, `--ns-sheet-rise`, `--ns-shift`, `--ns-side`, `--ns-signal`, `--ns-signal-ink`, `--ns-signal-wash`, `--ns-sk-figure`, `--ns-sk-land`, `--ns-sk-p`, `--ns-sk-p0`, `--ns-sk-p1`, `--ns-sk-p2`, `--ns-sk-p3`, `--ns-sk-p4`, `--ns-sk-p5`, `--ns-sk-p6`, `--ns-sk-p7`, `--ns-sk-read`, `--ns-sk-sweep`, `--ns-skeleton`, `--ns-skeleton-bone`, `--ns-skeleton-bone-light`, `--ns-skeleton-light`, `--ns-slab`, `--ns-slab-edge`, `--ns-slab-ink`, `--ns-sleep-awake`, `--ns-sleep-deep`, `--ns-sleep-light`, `--ns-sleep-rem`, `--ns-space-1`, `--ns-space-2`, `--ns-space-3`, `--ns-space-4`, `--ns-space-5`, `--ns-space-6`, `--ns-space-8`, `--ns-space-section`, `--ns-stack-fan`, `--ns-stack-fan-gap`, `--ns-stack-fan-lag`, `--ns-stack-on`, `--ns-stagger-item`, `--ns-stagger-mark`, `--ns-stagger-max`, `--ns-standing-critical`, `--ns-standing-in`, `--ns-standing-out`, `--ns-state-doing`, `--ns-state-done`, `--ns-state-review`, `--ns-state-todo`, `--ns-step`, `--ns-step-from`, `--ns-step-sign`, `--ns-swipe-surface`, `--ns-switch-h`, `--ns-switch-w`, `--ns-text-body`, `--ns-text-control`, `--ns-text-control-lg`, `--ns-text-display`, `--ns-text-editorial`, `--ns-text-empty`, `--ns-text-figure`, `--ns-text-giant`, `--ns-text-heading`, `--ns-text-headline`, `--ns-text-input`, `--ns-text-large`, `--ns-text-lede`, `--ns-text-meta`, `--ns-text-record`, `--ns-text-sentence`, `--ns-text-small`, `--ns-text-sub`, `--ns-text-title`, `--ns-theme-fade`, `--ns-tile-shadow`, `--ns-time-born`, `--ns-time-color`, `--ns-time-confirm`, `--ns-time-dialog`, `--ns-time-fling`, `--ns-time-flip`, `--ns-time-glide`, `--ns-time-grow`, `--ns-time-hold`, `--ns-time-menu`, `--ns-time-page`, `--ns-time-panel`, `--ns-time-quick`, `--ns-time-roll`, `--ns-time-settle`, `--ns-time-snap`, `--ns-time-spin`, `--ns-time-spring`, `--ns-time-sweep`, `--ns-time-toast`, `--ns-tint`, `--ns-tint-c`, `--ns-tint-ease`, `--ns-tint-fill`, `--ns-tint-gap`, `--ns-tint-h1`, `--ns-tint-h2`, `--ns-tint-h3`, `--ns-tint-ink`, `--ns-tint-row`, `--ns-tip-fold`, `--ns-tip-grow`, `--ns-toast-bottom`, `--ns-toast-gap`, `--ns-toast-left`, `--ns-toast-lift`, `--ns-toast-peek`, `--ns-toast-scale`, `--ns-toast-w`, `--ns-touch`, `--ns-tracking-body`, `--ns-tracking-caps`, `--ns-tracking-control`, `--ns-tracking-display`, `--ns-tracking-headline`, `--ns-tracking-sub`, `--ns-tracking-title`, `--ns-warn`, `--ns-warn-ink`, `--ns-wash-clay`, `--ns-wash-dusk`, `--ns-wash-graphite`, `--ns-wash-ink`, `--ns-wash-sage`, `--ns-wash-sand`, `--ns-weight-light`, `--ns-weight-medium`, `--ns-weight-regular`, `--ns-weight-strong`, `--ns-well`, `--ns-width-lg`, `--ns-width-md`, `--ns-width-sm`, `--ns-width-xl`.
- Never add Tailwind colour classes inside the component.

```tsx
import { Notch, type NotchItem } from "@/components/ui/notchset/blocks/notch";
```

## Parts
- A single export that takes props.

## Match the original
- Read `components/ui/notchset/blocks/notch.tsx`, `components/ui/notchset/disclosure-parts.tsx`, `components/ui/notchset/key-cap-parts.tsx`, `components/ui/notchset/run-pill-parts.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
- Where agents, sends or timers run while a person works elsewhere in the app, and a few of them may need a yes or an Undo.

### Not when
- One run on its own page is Run pill's; a one-off confirmation is a Toast's.

## Built from
- button (`button`), installed with it: reuse it, don't rebuild it
- live-label (`live-label`), installed with it: reuse it, don't rebuild it
- popover (`popover`), installed with it: reuse it, don't rebuild it
- rolling-clock (`rolling-clock`), installed with it: reuse it, don't rebuild it
- status-glyph-run (`status-glyph-run`), installed with it: reuse it, don't rebuild it
- stream-adapters (`stream-adapters`), installed with it: reuse it, don't rebuild it
- tool-row (`tool-row`), installed with it: reuse it, don't rebuild it
- Announce (shared helper, ships with it)
- Controllable (shared helper, ships with it)
- Feedback (shared helper, ships with it)
- Icons (shared helper, ships with it)
- Media (shared helper, ships with it)
- Words (shared helper, ships with it)

## Mistakes
- A notch that morphs without anything happening
- A loop that plays when nobody started anything
- A gate that hides the exact action behind a vague Approve
- An Undo shown after its window closed

## Usage

```tsx
"use client";
import * as React from "react";
import { Bell, CalendarDays, Home, Inbox, Search } from "@/lib/notchset/icons";
import { cn } from "@/lib/utils";
import { Notch, type NotchItem } from "@/components/ui/notchset/blocks/notch";
import { Button } from "@/components/ui/notchset/button";
import { CompanyMark } from "@/components/ui/notchset/company-mark";
import { MEDIA, useMedia } from "@/lib/notchset/media";

/*
 * The Assistant app's home, with the Notch set into its header (a pill over the tab bar on a phone). Nothing plays
 * by itself: each card starts its item on a press. The build fix runs its steps and waits at the push; the
 * follow-up asks before it sends, then keeps Undo for twelve seconds; the focus block counts down. The clock ticks
 * only while something works or settles, and stops when the last one folds away. Nothing is sent anywhere.
 */
type Kind = NotchItem["kind"];
type Row = NotchItem & { t: number; steps: { title: string; at?: number | undefined }[]; step: number; undoLeft: number };
const STEP_S = 3;
const UNDO_S = 12;
const FOLD_S = 4;
const VERCEL = <CompanyMark name="Vercel" color="#000000" glyph="m12 1.608 12 20.784H0Z" size="xs" />;
const RAYCAST = <CompanyMark name="Raycast" color="#ff6363" size="xs" />;

const RUN: Omit<Row, "id"> = {
  kind: "run",
  name: "Fix the failing build",
  phase: "running",
  present: "Reading the CI log",
  past: "Fixed the failing build",
  mark: VERCEL,
  clock: 0,
  steps: [{ title: "Reading the CI log" }, { title: "Patching the date test" }, { title: "Running the tests" }, { title: "Pushing to main" }],
  step: 0,
  undoLeft: 0,
  t: 0,
};
const SEND: Omit<Row, "id"> = {
  kind: "send",
  name: "Follow up with Raycast",
  phase: "waiting",
  present: "Sending 3 emails",
  past: "Sent 3 emails",
  outcome: "to Raycast",
  mark: RAYCAST,
  clock: 0,
  steps: [{ title: "Drafted 3 follow-ups", at: 0 }, { title: "Sending" }],
  step: 1,
  gate: { title: "Send 3 emails to Raycast?", detail: "To Ana Ruiz, Theo Park and Mia Chen, from your Gmail", allow: "Send" },
  undoLeft: 0,
  t: 0,
};
const TIMER: Omit<Row, "id"> = { kind: "timer", name: "Focus block", phase: "running", present: "Focus block", past: "Focus block ended", clock: 25 * 60, steps: [], step: 0, undoLeft: 0, t: 0 };
const BASE: Record<Kind, Omit<Row, "id">> = { run: RUN, send: SEND, timer: TIMER };

/* one second of the world: clocks count, steps advance, undo windows close, settled rows fold away */
function tick(a: Row): Row | null {
  const t = a.t + 1;
  if (a.kind === "timer") {
    if (a.phase !== "running") return ended(a) ? (t >= FOLD_S ? null : { ...a, t }) : a;
    const clock = Math.max(0, a.clock - 1);
    return clock === 0 ? { ...a, clock, phase: "done", outcome: "25 min", t: 0 } : { ...a, clock, t };
  }
  if (a.phase === "running") {
    const clock = a.clock + 1;
    if (t < STEP_S) return { ...a, clock, t };
    const steps = a.steps.map((s, i) => (i === a.step ? { ...s, at: clock } : s));
    const step = a.step + 1;
    if (a.kind === "run" && step === 3 && !a.gate)
      return { ...a, clock, steps, step, t: 0, phase: "waiting", present: "Waiting to push", gate: { title: "Push 1 commit to main?", detail: "Starts a production deploy on Vercel", allow: "Push" } };
    if (step >= a.steps.length) return { ...a, clock, steps, step, t: 0, phase: "done", outcome: a.kind === "run" ? "1 commit pushed" : a.outcome, undoLeft: UNDO_S };
    return { ...a, clock, steps, step, t: 0, present: a.steps[step]!.title };
  }
  if (a.phase === "done" && a.undoLeft > 0) return { ...a, undoLeft: a.undoLeft - 1, t: 0 };
  if (ended(a)) return t >= FOLD_S ? null : { ...a, t };
  return a;
}
const ended = (a: Row) => a.phase === "done" || a.phase === "stopped" || a.phase === "undone";

type Act = { type: "add"; row: Row } | { type: "tick" } | { type: "set"; id: string; f: (a: Row) => Row };
let born = 0;
const make = (kind: Kind): Row => ({ ...BASE[kind], id: `${kind}-${++born}` });
function reduce(list: Row[], act: Act): Row[] {
  if (act.type === "add") return list.some((a) => a.kind === act.row.kind) ? list : [...list, act.row];
  if (act.type === "tick") return list.map(tick).filter((a): a is Row => a !== null);
  return list.map((a) => (a.id === act.id ? act.f(a) : a));
}
/* where the page opens: quiet, or with the queue stacked and one gate waiting */
const OPEN: Record<string, Kind[]> = { rest: [], stacked: ["timer", "run", "send"] };

export default function NotchDemo() {
  const view = "rest";
  return <Stage key={view} start={OPEN[view] ?? []} />;
}

function Stage({ start }: { start: Kind[] }) {
  const [list, dispatch] = React.useReducer(reduce, start, (s) => s.map(make));
  const phone = useMedia(MEDIA.phone);
  const [focusGate, setFocusGate] = React.useState<string | null>(null);
  const live = list.some((a) => a.phase === "running" || ended(a));
  React.useEffect(() => {
    if (!live) return;
    const id = window.setInterval(() => dispatch({ type: "tick" }), 1000);
    return () => window.clearInterval(id);
  }, [live]);
  const set = (id: string, f: (a: Row) => Row) => dispatch({ type: "set", id, f });
  const has = (k: Kind) => list.some((a) => a.kind === k);
  const add = (kind: Kind) => {
    if (has(kind)) return;
    const row = make(kind);
    dispatch({ type: "add", row });
    /* the gate this press raises takes focus: the hand is already there */
    if (kind === "send") setFocusGate(row.id);
  };
  const cards = [
    { key: "run" as const, mark: <CompanyMark name="Vercel" color="#000000" glyph="m12 1.608 12 20.784H0Z" size="md" />, title: "Fix the failing build", line: "web · main · 2 checks failing", cta: "Start run", on: () => add("run") },
    { key: "send" as const, mark: <CompanyMark name="Raycast" color="#ff6363" size="md" />, title: "Follow up with Raycast", line: "3 drafts ready · Ana, Theo and Mia", cta: "Send 3 emails", on: () => add("send") },
    {
      key: "timer" as const,
      mark: (
        <span className="flex size-7 items-center justify-center rounded-[var(--ns-radius-sm)] bg-[var(--ns-well)] text-[var(--ns-ink-2)]">
          <CalendarDays aria-hidden className="size-4" strokeWidth={1.75} />
        </span>
      ),
      title: "Focus block",
      line: "Write the Q4 launch notes",
      cta: "Start 25:00",
      on: () => add("timer"),
    },
  ];
  const notch = (
    <Notch
      items={list}
      place={phone ? "pill" : "header"}
      pillBottom={74}
      focusGate={focusGate}
      onAllow={(id) => set(id, (a) => (a.phase === "waiting" ? { ...a, phase: "running", present: a.steps[a.step]?.title ?? a.present, t: 0 } : a))}
      onDeny={(id) => set(id, (a) => (a.phase === "waiting" ? { ...a, phase: "stopped", past: a.kind === "send" ? "Didn't send the emails" : "Stopped before the push", outcome: undefined, t: 0 } : a))}
      onUndo={(id) => set(id, (a) => (a.phase === "done" ? { ...a, phase: "undone", past: a.kind === "send" ? "Unsent 3 emails" : "Reverted the push", outcome: undefined, t: 0, undoLeft: 0 } : a))}
      onPause={(id) => set(id, (a) => (a.phase === "running" ? { ...a, phase: "paused" } : a.phase === "paused" ? { ...a, phase: "running" } : a))}
      onStop={(id) => set(id, (a) => ({ ...a, phase: "stopped", past: a.kind === "timer" ? "Focus block stopped" : "Stopped the run", outcome: undefined, t: 0 }))}
    />
  );
  return (
    <div
      role="group"
      aria-label="The Assistant app"
      className={cn("relative isolate mx-auto flex w-full flex-col overflow-hidden rounded-[var(--ns-radius-xl)] bg-[var(--ns-canvas)] text-[var(--ns-ink)] shadow-[var(--ns-depth-card)]", phone ? "h-[640px] max-w-[390px]" : "h-[520px] max-w-[1040px]")}
    >
      <header className="relative z-20 flex h-14 shrink-0 items-center gap-3 border-b border-[var(--ns-line)] bg-[var(--ns-panel)] px-4">
        <span className="flex min-w-0 items-center gap-2 text-[length:var(--ns-text-body)] font-[number:var(--ns-weight-medium)]">
          <span aria-hidden className="size-5 rounded-[var(--ns-radius-sm)] bg-[var(--ns-signal)]" />
          Assistant
        </span>
        <div className="flex min-w-0 flex-1 justify-center">{phone ? null : notch}</div>
        {!phone && (
          <span className="flex items-center gap-3 text-[var(--ns-ink-3)]">
            <Search aria-hidden className="size-4" strokeWidth={1.75} />
            <Bell aria-hidden className="size-4" strokeWidth={1.75} />
          </span>
        )}
        <span aria-hidden className="flex size-7 items-center justify-center rounded-full bg-[var(--ns-well)] text-[length:var(--ns-text-meta)] font-[number:var(--ns-weight-medium)] text-[var(--ns-ink-2)]">
          JL
        </span>
      </header>
      <div className="flex min-h-0 flex-1">
        {!phone && (
          <nav aria-label="Sections" className="flex w-44 shrink-0 flex-col gap-0.5 border-e border-[var(--ns-line)] bg-[var(--ns-panel)] p-3 text-[length:var(--ns-text-small)]">
            {["Home", "Runs", "Inbox", "Calendar"].map((n, i) => (
              <span key={n} className={cn("rounded-[var(--ns-radius-control-sm)] px-2.5 py-1.5", i === 0 ? "bg-[var(--ns-selected)] text-[var(--ns-ink)]" : "text-[var(--ns-ink-2)]")}>
                {n}
              </span>
            ))}
          </nav>
        )}
        <main className={cn("min-w-0 flex-1 overflow-hidden", phone ? "px-4 pt-8" : "px-10 pt-14")}>
          <h2 className="m-0 text-[length:var(--ns-text-title)] font-[number:var(--ns-weight-medium)] tracking-tight">Good morning</h2>
          <p className="m-0 mt-1 text-[length:var(--ns-text-small)] text-[var(--ns-ink-3)]">Three things are ready to start. The Notch keeps them in view while you work.</p>
          <ul className={cn("m-0 mt-6 grid list-none gap-3 p-0", phone ? "grid-cols-1" : "grid-cols-3")}>
            {cards.map((c) => (
              <li key={c.key} className="flex flex-col gap-3 rounded-[var(--ns-radius-xl)] bg-[var(--ns-depth-surface)] p-4 shadow-[var(--ns-depth-card)]">
                <div className="flex items-center gap-3">
                  {c.mark}
                  <div className="min-w-0">
                    <div className="truncate text-[length:var(--ns-text-body)] font-[number:var(--ns-weight-medium)]">{c.title}</div>
                    <div className="truncate text-[length:var(--ns-text-small)] text-[var(--ns-ink-3)]">{c.line}</div>
                  </div>
                </div>
                <Button size="sm" intent={c.key === "send" ? "primary" : "secondary"} onClick={c.on} disabled={has(c.key)} className="self-start">
                  {c.cta}
                </Button>
              </li>
            ))}
          </ul>
        </main>
      </div>
      {phone && (
        <>
          {notch}
          <nav aria-label="Tabs" className="relative z-10 flex h-16 shrink-0 items-start justify-around border-t border-[var(--ns-line)] bg-[var(--ns-panel)] pt-2">
            {[
              { n: "Home", I: Home },
              { n: "Inbox", I: Inbox },
              { n: "Calendar", I: CalendarDays },
              { n: "Search", I: Search },
            ].map(({ n, I }, i) => (
              <span key={n} className={cn("flex w-16 flex-col items-center gap-0.5 text-[length:var(--ns-text-meta)]", i === 0 ? "text-[var(--ns-ink)]" : "text-[var(--ns-ink-3)]")}>
                <I aria-hidden className="size-5" strokeWidth={1.75} />
                {n}
              </span>
            ))}
          </nav>
        </>
      )}
    </div>
  );
}
```

This example also uses `company-mark` (https://notchset.dev/components/company-mark). Installing this item doesn't bring them; to paste the example as it is: `npx shadcn@latest add @notchset-pro/notch @notchset/company-mark`. The `@notchset-pro` items are Pro: they need the registries in components.json and the key (Setup).

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `items` | `readonly NotchItem[]` |  | the items, in any order: the Notch speaks for the one that matters most |
| `place` | `"header" \| "pill"` |  | header: the rail sits where it is placed; pill: it floats at the foot of its positioned host. By default a pill below 600px wide, the rail above |
| `pillBottom` | `number` | `16` | the pill's distance from its host's foot (above a tab bar), in px |
| `onAllow` | `(id: string) => void` |  |  |
| `onDeny` | `(id: string) => void` |  |  |
| `onUndo` | `(id: string) => void` |  |  |
| `onPause` | `(id: string) => void` |  | pause or resume a timer |
| `onStop` | `(id: string) => void` |  |  |
| `focusGate` | `string \| null` |  | the id of a gate the person's own press just raised: it takes focus, since the hand is already there |
| `peekMs` | `number` | `4000` | how long a phase change peeks its words, in ms |
| `labels` | `Partial<NotchLabels>` |  |  |

Full docs: https://notchset.dev/blocks/notch

## Customising
- Colours: every part reads the foundation's roles (`--ns-canvas`, `--ns-ink`, `--ns-line`, `--ns-signal` …), which read your shadcn tokens (`--background`, `--foreground`, `--border`, `--destructive` …), plus the optional `--success` and `--warning`. Retheme on `:root` or any container; never add Tailwind colour classes inside the component.
- Dark mode follows the `.dark` class or `data-theme="dark"` on an ancestor (the shadcn and next-themes conventions).
- Update later: Commit or stash local changes first (or copy the files), so the update can be undone. Read https://notchset.dev/r/changelog.json for the new versions: a major version, an entry marked breaking or a merge says what to change. Then re-run the install with `--overwrite`, on a branch. It replaces the component's files, the shared helper files they import, and the item's CSS rules in the global stylesheet, so review the whole diff (components, shared files, CSS), re-apply your own edits, and run the app's typecheck, tests and build.

## Keyboard

| Keys | Action |
|---|---|
| Tab | to the lit segment, then into its card |
| Left or Right, Home, End | walk the segments |
| Enter or Space | open or close a segment's card |
| Enter in a gate | Allow |
| Esc | Deny in a gate; otherwise close the card |

## Performance

- No timers of its own beyond one peek; the host owns the clock and ticks only while something works.

## Responsive

- phone: a frosted pill above the tab bar, the card opens upward
- dark (tokens)
- reduced motion: the card and words land at once

## Motion inventory

| Interaction | What moves |
|---|---|
| the lit segment lifts out of the rail | --ns-depth-lift, --ns-time-spring on --ns-ease-spring. Reduced motion: lands at once (data-ns-glide). |
| a peek: the words glide open beside the mark | max-width on --ns-time-page, --ns-ease-panel; opacity on --ns-time-menu. Reduced motion: shown at once. |
| the card drops from the rail, its content a beat after | ns-play-open on --ns-play-open, --ns-ease-pop; its content ns-island-in on --ns-time-dialog after --ns-time-quick. Reduced motion: fades in (data-ns-play). |

## Accessibility contract (preserve when editing)
- A region named Queue.
- The rail is one tab stop: the lit segment, a button saying its state and Show details; arrows, Home and End walk the segments.
- The card's first control takes focus when opened; Esc closes it and focus returns.
- A gate the person raised takes focus; Enter allows and Esc denies inside it.
- Each phase is said once in the polite live region.

## Install

```bash
# npm
npx shadcn@latest add @notchset-pro/notch
# pnpm
pnpm dlx shadcn@latest add @notchset-pro/notch
# yarn
yarn dlx shadcn@latest add @notchset-pro/notch
# bun
bunx --bun shadcn@latest add @notchset-pro/notch
```

Pro item: needs the `@notchset-pro` registry in `components.json` and `NOTCHSET_TOKEN` in `.env.local` (https://notchset.dev/account). Setup: https://notchset.dev/docs/pro. Every components.json `style` gets the same files.

### Manual

1. Install the packages: `npm install lucide-react@^1`.
2. Copy `components/ui/notchset/blocks/notch.tsx`, `lib/notchset/announce.ts`, `lib/notchset/controllable.ts`, `components/ui/notchset/disclosure-parts.tsx`, `lib/notchset/feedback.ts`, `lib/notchset/icons.ts`, `components/ui/notchset/key-cap-parts.tsx`, `lib/notchset/media.ts`, `components/ui/notchset/run-pill-parts.tsx`, `lib/notchset/words.ts` from https://notchset.dev/r/pro/notch.json, sent with the header `Authorization: Bearer ${NOTCHSET_TOKEN}` (each file's `content`, at its `target`), keeping the `@/` path alias of your tsconfig.
3. Add what it builds on: shadcn `utils` (cn), `notchset-foundation`, `button`, `live-label`, `popover`, `rolling-clock`, `status-glyph-run`, `stream-adapters`, `tool-row`.

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