# Action Rail (Notchset): prompt.md (v1.0.0)

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

An expanding button group where one label travels along the rail: the primary keeps its name, the others are icons until you point at one or tab to it, each confirms in place in the past tense with a status line under the rail, and Delete asks twice.

## 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/action-rail.tsx`; shared code: `lib/beautiful-ui/notchset/instrument.tsx`, `lib/beautiful-ui/notchset/root.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: `ActionRail`, 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-sheet-from`, `--notchset-signal`, `--notchset-sweep-to`, `--notchset-travel`). Never add Tailwind colour classes inside the component.

```tsx
import { ActionRail } from "@/components/ui/notchset/action-rail";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `ActionRail` | `action-rail` | The keys on their plate and the status line. |
| `Key` | `action-rail-key` | One action: icon, travelling label and its result. |

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://notchset.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/action-rail.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
- expanding button group, action bar, row actions, message actions, file actions, icon buttons with labels, two-step delete, Notchset
- A compact action bar on a message, a file or a card, where labels should be one glance away
- Actions that finish in place and deserve a confirmation without a toast (Archive, Copy link)

### Not when
- Choosing a value: use Segmented Control or Toggle
- One or two actions with room to spare: plain labelled buttons read faster
- More than about six actions: use a Dropdown Menu

## Mistakes
- Put the primary first: the label rests on it
- Keep labels to one or two words: they slide out, they don't wrap
- Return a short sentence from onSelect when the result carries news

## Usage

```tsx
"use client";

import { ActionRail } from "@/components/ui/notchset/action-rail";

export function MessageActions({ reply, archive, remove }: { reply: () => void; archive: () => void; remove: () => void }) {
  return (
    <ActionRail
      aria-label="Message actions"
      actions={[
        { id: "reply", label: "REPLY", icon: <span>↩</span>, intent: "primary", onSelect: reply },
        { id: "archive", label: "ARCHIVE", icon: <span>▤</span>, doneLabel: "ARCHIVED", onSelect: () => (archive(), "MOVED TO ARCHIVE") },
        { id: "delete", label: "DELETE", icon: <span>✕</span>, intent: "danger", doneLabel: "DELETED", onSelect: () => (remove(), "MOVED TO TRASH") },
      ]}
    />
  );
}
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `actions` | `{ id, label, icon, doneLabel?, intent?, pressed?, onSelect? }[]` |  | In order; the primary (intent "primary") keeps its name. onSelect may return a sentence for the status line. |
| `intent` | `"primary" \| "danger" \| "toggle"` |  | Primary is ink and always named; danger asks twice; toggle reports aria-pressed from `pressed`. |
| `confirmDelete` | `boolean` |  | Danger actions ask twice. Default true. |
| `status` | `boolean` |  | The status line under the rail. Default true. |
| `labels` | `{ armed, armedStatus, cancelled, hint }` |  | Every word, for other languages. |

Full docs: https://notchset.dev/components/action-rail

## 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://notchset.dev/r/changelog.json

## Keyboard

| Keys | Action |
|---|---|
| ← → / Home End | Move between keys |
| Enter / Space | Run; on Delete, arm then delete |
| Esc | Cancel an armed delete |

## Performance

- One measurement per label change; the travel is a width transition.

## Responsive

- Folded keys are 40px squares, so a rail of five is the primary's label plus 160px.
- 44px keys on touch screens.

## Motion inventory

| Interaction | What moves |
|---|---|
| Travel | The active key's label widens from nothing to its width (360ms glide); the text fades in after 120ms and out in 100ms |
| Press | The content moves down 1px (90ms linear) |
| Done | The label flips to the past tense for 1.6s |
| Arm | The key fills with signal and the plate turns signal; it disarms after 3s |

## Accessibility contract (preserve when editing)
- A toolbar with one tab stop; ← → move between keys, Home and End jump to the ends
- Every key is named by its action; an armed delete says to press again; toggles report aria-pressed
- The status line is a polite live region

## Install

```bash
npx shadcn@latest add @notchset-pro/action-rail
```

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