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

- id: `float-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/float-rail`
- npm dependencies: none
- registry dependencies: utils, https://notchset.dev/r/notchset-foundation.json
- docs: https://notchset.dev/components/float-rail
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

A toolbar that floats over a canvas, as a bar or a vertical rail: a deeper plate, groups cut apart by signal notches, readouts that roll (the undo step, the zoom), icon keys whose names drop on leader lines, latching keys, and a labelled key that goes live in signal with a running clock.

## 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/float-rail.tsx`; shared code: `lib/beautiful-ui/notchset/roving.tsx`, `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: `FloatRail`, `FloatRailButton`, `FloatRailKey`, `FloatRailNotch`, `FloatRailReadout`, 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 { FloatRail, FloatRailButton, FloatRailKey, FloatRailNotch, FloatRailReadout } from "@/components/ui/notchset/float-rail";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `FloatRail` | `float-rail` | The floating toolbar on its plate. |
| `FloatRailKey / FloatRailButton` | `float-rail-key` | Icon keys with tags, and labelled keys that can go live. |
| `FloatRailReadout` | `float-rail-readout` | A rolling reading. |
| `FloatRailNotch` | `float-rail-notch` | A group divider with its notch. |

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/float-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
- floating toolbar, floating button group, canvas toolbar, editor toolbar, vertical tool rail, zoom controls, present button, Notchset
- A canvas, board or editor toolbar with undo, share and present
- A vertical tool rail with zoom and view toggles

### Not when
- A toolbar fixed in the page flow: use Toolbar
- Choosing one view: use Segmented Control
- More actions than fit in one bar: put the rest in a Dropdown Menu

## Mistakes
- Keep a latching key's label constant: the pressed state is announced, the name shouldn't flip
- Bind the shortcuts you show
- Position the rail yourself (absolute over your canvas); it doesn't place itself

## Usage

```tsx
"use client";

import * as React from "react";
import { FloatRail, FloatRailButton, FloatRailKey, FloatRailNotch, FloatRailReadout } from "@/components/ui/notchset/float-rail";

export function BoardBar({ undo, redo, step, steps }: { undo: () => void; redo: () => void; step: number; steps: number }) {
  const [presenting, setPresenting] = React.useState(false);
  return (
    <FloatRail aria-label="Board">
      <FloatRailKey label="Undo" kbd="⌘Z" icon={<span>↶</span>} disabled={step === 0} onClick={undo} />
      <FloatRailReadout label="STEP" value={step} />
      <FloatRailKey label="Redo" kbd="⇧⌘Z" icon={<span>↷</span>} disabled={step === steps} onClick={redo} />
      <FloatRailNotch />
      <FloatRailButton live={presenting} onClick={() => setPresenting((p) => !p)}>
        {presenting ? "LIVE" : "PRESENT"}
      </FloatRailButton>
    </FloatRail>
  );
}
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `FloatRail orientation` | `"horizontal" \| "vertical"` |  | A bar (tags drop below) or a rail (tags sit beside it; ↑ ↓ move focus). |
| `FloatRailKey label / icon / kbd` | `string / ReactNode / string` |  | An icon key: its name (accessible name and tag), the icon, and a shortcut shown and announced (bind it yourself). |
| `FloatRailKey pressed` | `boolean` |  | A latching key: stays down while true (aria-pressed). |
| `FloatRailButton children / icon` | `string / ReactNode` |  | A labelled key; the label flips when it changes ("SHARE" → "LINK COPIED"). |
| `FloatRailButton live / reading` | `boolean / ReactNode` |  | Live: signal fill, a blinking node and a reading such as a clock (presenting, recording). |
| `FloatRailReadout label / value` | `string / string \| number` |  | A reading on the rail; digits roll when it changes. |
| `FloatRailNotch` | `-` |  | Cuts the rail into groups. |

Full docs: https://notchset.dev/components/float-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 |
|---|---|
| ← → / ↑ ↓ | Move between keys (bar / rail) |
| Home / End | First or last key |
| Esc | Hide the tags until the pointer moves |

## Performance

- Plain buttons and CSS; readouts animate with transforms only.

## Responsive

- A bar of seven keys is about 320px; on narrow screens prefer the vertical rail or fewer labelled keys.
- 44px keys on touch screens.

## Motion inventory

| Interaction | What moves |
|---|---|
| Tag | The leader draws after 300ms on hover (at once on keyboard focus); the tag fades and settles 3px after 390ms (90ms on focus) |
| Readout | Digits roll 620ms, the ones digit first |
| Live | The key fills with signal, its node blinks and its label flips |
| Press | The icon drops 1px and scales to .9, springing back over 240ms |

## Accessibility contract (preserve when editing)
- A toolbar with its orientation and one tab stop; ← → (or ↑ ↓ on a rail), Home and End move between keys
- Icon keys are named by their label; latching keys and the live key report aria-pressed
- Readouts are polite status regions; tags are decoration for sighted users (the name is on the key); Esc hides them

## Install

```bash
npx shadcn@latest add @notchset-pro/float-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.
