# Reorderable list (Notchset): prompt.md (v1.1.0)

- id: `reorderable-list` · version 1.1.0 · component · free
- category: Lists and tables
- build: one set of files for every shadcn style
- install: `npx shadcn@latest add https://notchset.dev/r/reorderable-list.json`
- npm dependencies: lucide-react@^1
- registry dependencies: utils, https://notchset.dev/r/notchset-foundation.json, @notchset/icon-button, @notchset/menu
- docs: https://notchset.dev/components/reorderable-list
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

A person's own list put in order by hand (pipeline stages, statuses, saved views). Drag a row by its grip: it lifts flat on the float shadow, stays under the pointer, neighbours glide aside and it lands where it is let go; Esc sends it home. The row's ⋯ menu and Alt+↑ ↓ move it without a pointer..

## 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/reorderable-list.tsx`; shared code: `lib/notchset/gesture-list.ts`, `lib/notchset/gesture.ts`, `lib/notchset/icons.ts`, `lib/notchset/motion.ts`, `lib/notchset/words.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `notchset-foundation`, `icon-button`, `menu`.
- Builds: one set of files, the same for every shadcn style.
- Exports to keep: `REORDERABLE_LIST_LABELS`, `ReorderableList`, 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-ease-move`, `--ns-icon`, `--ns-ink`, `--ns-ink-3`, `--ns-line-soft`, `--ns-radius-lg`, `--ns-radius-sm`, `--ns-raised`, `--ns-shadow-float`, `--ns-signal`, `--ns-text-body`, `--ns-text-small`, `--ns-time-color`, `--ns-time-snap`.
- 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 { Card } from "@/components/ui/notchset/card";
```

## Parts
- A single export that takes props.

## Match the original
- Read `components/ui/notchset/reorderable-list.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
- A short list whose order is the person's own and means something (stages, statuses, saved views).

### Not when
- A list sorted by a column is a table's sort; moving cards between lanes is Board.

## Built from
- icon-button (`icon-button`), installed with it: reuse it, don't rebuild it
- menu (`menu`), installed with it: reuse it, don't rebuild it
- Gesture list (shared helper, ships with it)
- Gesture (shared helper, ships with it)
- Icons (shared helper, ships with it)
- Motion (shared helper, ships with it)
- Words (shared helper, ships with it)

## Mistakes
- Ordering a list that is sorted by a column: that is a table's sort
- Hiding the menu twin: a drag alone leaves out keyboards and screen readers
- Tilting the lifted row: it lifts flat

## Usage

```tsx
"use client";
import * as React from "react";
import { Card } from "@/components/ui/notchset/card";
import { ReorderableList, type ReorderableItem } from "@/components/ui/notchset/reorderable-list";

/*
 * A sales pipeline's stages, put in order by hand: drag a stage by its grip and the others make room; let go and it
 * lands where you left it; Esc puts it back. Each stage's ⋯ moves it up, down or to the top, and Alt with ↑ or ↓
 * moves the focused stage. The line under it says the order as it is now; the knob shows each stage's deal count.
 */
const STAGES: ReorderableItem[] = [
  { id: "lead", label: "Lead", detail: "24" },
  { id: "qualified", label: "Qualified", detail: "16" },
  { id: "proposal", label: "Proposal", detail: "9" },
  { id: "negotiation", label: "Negotiation", detail: "5" },
  { id: "won", label: "Won", detail: "12" },
];

export default function ReorderableListDemo() {
  const counts = true;
  const [stages, setStages] = React.useState(STAGES);
  return (
    <div className="flex w-[min(100%,var(--ns-width-sm))] flex-col gap-3">
      <Card inset className="p-1">
        <ReorderableList label="Pipeline stages" items={counts ? stages : stages.map(({ detail: _, ...s }) => s)} onReorder={(next) => setStages(next.map((s) => STAGES.find((x) => x.id === s.id)!))} />
      </Card>
      <p className="m-0 truncate text-[length:var(--ns-text-small)] text-[var(--ns-ink-3)]">{stages.map((s) => s.label).join(" → ")}</p>
    </div>
  );
}
```

This example also uses `card` (https://notchset.dev/components/card). Installing this item doesn't bring them; to paste the example as it is: `npx shadcn@latest add https://notchset.dev/r/reorderable-list.json https://notchset.dev/r/card.json`.

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `items` | `readonly ReorderableItem[]` |  | the rows, in the person's order |
| `onReorder` | `(items: ReorderableItem[]) => void` |  | the new order, after a drag or a move from the menu or the keys |
| `label` | `string` |  | what the list is ("Pipeline stages"), for screen readers |
| `labels` | `Partial<ReorderableListLabels>` |  | its built-in words, English by default |

Full docs: https://notchset.dev/components/reorderable-list

## 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 |
|---|---|
| Alt+↑ Alt+↓ | move the focused row up or down |
| Esc | while dragging, put the row back |
| Enter or Space on ⋯ | Move up, Move down, Move to top |

## Performance

- A drag moves rows by transform only, with no render until it is let go; the list measures once when the drag starts.

## Responsive

- phone: the grip takes the touch (no scroll from it)
- desktop
- dark (tokens)
- reduced motion: rows move at once, the lift without a glide

## Motion inventory

| Interaction | What moves |
|---|---|
| the row lifts flat onto the float shadow | scale 1.02 and --ns-shadow-float on --ns-time-snap, --ns-ease-move. Reduced motion: lifts at once. |
| neighbours glide out of the way | transform on --ns-time-snap, --ns-ease-move. Reduced motion: they move at once. |
| let go, it lands from exactly where it was, without overshoot; a menu or key move glides every row to its place (FLIP) | transform on --ns-time-snap, --ns-ease-move. Reduced motion: the new order at once. |
| Esc: everything glides home | transform on --ns-time-snap, --ns-ease-move. Reduced motion: home at once. |

## Accessibility contract (preserve when editing)
- A named list; each row's grip is a button named "Drag to reorder Negotiation" and the list says Alt and the arrow keys move a row; the ⋯ menu moves it without a pointer; each move is said politely ("Negotiation moved to 2 of 5").

## Install

```bash
# npm
npx shadcn@latest add https://notchset.dev/r/reorderable-list.json
# pnpm
pnpm dlx shadcn@latest add https://notchset.dev/r/reorderable-list.json
# yarn
yarn dlx shadcn@latest add https://notchset.dev/r/reorderable-list.json
# bun
bunx --bun shadcn@latest add https://notchset.dev/r/reorderable-list.json
```

Or add the `@notchset` registry to components.json and run `npx shadcn@latest add @notchset/reorderable-list`. Every components.json style gets the same files.

### Manual

1. Install the packages: `npm install lucide-react@^1`.
2. Copy `components/ui/notchset/reorderable-list.tsx`, `lib/notchset/gesture-list.ts`, `lib/notchset/gesture.ts`, `lib/notchset/icons.ts`, `lib/notchset/motion.ts`, `lib/notchset/words.ts` from https://notchset.dev/r/reorderable-list.json (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`, `icon-button`, `menu`.

## Continue the workflow

- [Bulk bar](https://notchset.dev/blocks/bulk-bar)
- [Data table](https://notchset.dev/blocks/data-table)
- [Filter bar](https://notchset.dev/blocks/filter-bar)

## Source

### components/ui/notchset/reorderable-list.tsx

```tsx
// Notchset reorderable-list 1.1.0 · https://notchset.dev/changelog
"use client";
import * as React from "react";
import { ArrowDown, ArrowUp, ArrowUpToLine, Ellipsis, GripVertical } from "@/lib/notchset/icons";
import { cn } from "@/lib/utils";
import { IconButton } from "@/components/ui/notchset/icon-button";
import { useGestures } from "@/lib/notchset/gesture-list";
import { Menu, MenuItem } from "@/components/ui/notchset/menu";
import { lessMotion } from "@/lib/notchset/motion";
import { fill } from "@/lib/notchset/words";

/* layout effects run as plain effects on the server, so React 18 server rendering stays silent */
const useIsomorphicLayoutEffect = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;

/*
 * Reorderable list: a person's own list put in their order by hand (a pipeline's stages, a board's statuses, saved
 * views). Drag a row by its grip: it lifts straight up on the float shadow and stays under the pointer, its neighbours
 * glide out of the way on --ns-ease-move, and let go it lands exactly where it is, without overshoot. Esc sends it
 * home. The row's ⋯ menu is the keyboard's twin (Move up, Move down, Move to top), and Alt+↑ or Alt+↓ on a row moves
 * it too; each move is said to a screen reader. Less motion moves the rows at once.
 *
 * The list is the host's: it hands `items` and gets the new order from `onReorder` (save it there). It draws its rows
 * only; the card or panel it sits in is the host's.
 *
 *   <ReorderableList label="Pipeline stages" items={stages} onReorder={setStages} />
 */
type ReorderableItem = {
  /** a stable id for the row */
  id: string;
  /** what the row says ("Negotiation") */
  label: string;
  /** a quiet end of the row (a count, a colour mark) */
  detail?: React.ReactNode;
};
type ReorderableListProps = {
  /** the rows, in the person's order */
  items: readonly ReorderableItem[];
  /** the new order, after a drag or a move from the menu or the keys */
  onReorder: (items: ReorderableItem[]) => void;
  /** what the list is ("Pipeline stages"), for screen readers */
  label: string;
  /** its built-in words, English by default */
  labels?: Partial<ReorderableListLabels> | undefined;
  className?: string | undefined;
};
/** Its words: `{label}`, `{at}` and `{of}` are blanks. */
type ReorderableListLabels = { grip: string; actions: string; up: string; down: string; top: string; moved: string; back: string; hint: string };
const REORDERABLE_LIST_LABELS: ReorderableListLabels = {
  grip: "Drag to reorder {label}",
  actions: "Move {label}",
  up: "Move up",
  down: "Move down",
  top: "Move to top",
  moved: "{label} moved to {at} of {of}",
  back: "{label} put back",
  hint: "Alt and the arrow keys move a row",
};

const move = <T,>(list: readonly T[], from: number, to: number) => {
  const next = list.slice();
  const [row] = next.splice(from, 1);
  next.splice(to, 0, row!);
  return next;
};

type Drag = { id: string; from: number; to: number; dy: number; tops: number[]; heights: number[] };

function ReorderableList({ items, onReorder, label, labels, className }: ReorderableListProps) {
  const L = { ...REORDERABLE_LIST_LABELS, ...labels };
  const list = React.useRef<HTMLUListElement>(null);
  const drag = React.useRef<Drag | null>(null);
  const [dragging, setDragging] = React.useState<string | null>(null);
  const [said, setSaid] = React.useState("");
  const hintId = React.useId();
  /* where each row stood before a move, so the rows that moved glide from there (FLIP), and where the dragged one was let go */
  const before = React.useRef<Map<string, number> | null>(null);
  const landed = React.useRef<{ id: string; y: number } | null>(null);
  const rowsOf = () => [...(list.current?.querySelectorAll<HTMLElement>(":scope > [data-row]") ?? [])];
  const snapshot = () => (before.current = new Map(rowsOf().map((r) => [r.dataset.row!, r.getBoundingClientRect().top])));

  const commit = (from: number, to: number, how: "drag" | "keys") => {
    if (from === to) return;
    if (how === "keys") snapshot();
    const next = move(items, from, to);
    setSaid(fill(L.moved, { label: items[from]!.label, at: String(to + 1), of: String(items.length) }));
    onReorder(next);
  };

  /* after the new order is drawn: each row glides from where it stood to its new place; the dragged one from where it was let go */
  useIsomorphicLayoutEffect(() => {
    const was = before.current;
    const drop = landed.current;
    before.current = null;
    landed.current = null;
    if (!was && !drop) return;
    const still = lessMotion(list.current);
    const rows = rowsOf();
    /* the drag's own offsets come off first, so each row is measured where the new order puts it */
    for (const r of rows) {
      r.style.transition = "none";
      r.style.transform = "";
    }
    for (const r of rows) {
      const id = r.dataset.row!;
      const now = r.getBoundingClientRect().top;
      const from = drop?.id === id ? drop.y : was?.get(id);
      r.style.transition = "none";
      r.style.transform = from === undefined || still ? "" : `translateY(${from - now}px)`;
      if (drop?.id === id) r.style.zIndex = "1";
      void r.offsetWidth;
      r.style.transition = still ? "" : "transform var(--ns-time-snap) var(--ns-ease-move), box-shadow var(--ns-time-snap) var(--ns-ease-move), scale var(--ns-time-snap) var(--ns-ease-move)";
      r.style.transform = "";
    }
    /* the dropped row settles its lift as it lands */
    if (drop) window.setTimeout(() => {
      const r = list.current?.querySelector<HTMLElement>(`:scope > [data-row="${CSS.escape(drop.id)}"]`);
      if (r) r.style.zIndex = "";
    }, 300);
  }, [items]);

  /* the rows between where the dragged row started and where it would land step aside by its height */
  const lay = (d: Drag) => {
    const rows = rowsOf();
    const h = d.heights[d.from]!;
    rows.forEach((r, i) => {
      if (i === d.from) return;
      const shift = d.from < d.to && i > d.from && i <= d.to ? -h : d.from > d.to && i >= d.to && i < d.from ? h : 0;
      r.style.transform = shift ? `translateY(${shift}px)` : "";
    });
  };

  const end = (keep: boolean) => {
    const d = drag.current;
    drag.current = null;
    setDragging(null);
    if (!d) return;
    const rows = rowsOf();
    const row = rows[d.from];
    const still = lessMotion(list.current);
    if (!keep || d.to === d.from) {
      /* home: everything glides back to its place */
      for (const r of rows) {
        r.style.transition = still ? "" : "transform var(--ns-time-snap) var(--ns-ease-move), box-shadow var(--ns-time-snap) var(--ns-ease-move), scale var(--ns-time-snap) var(--ns-ease-move)";
        r.style.transform = "";
      }
      if (!keep) setSaid(fill(L.back, { label: items[d.from]!.label }));
      return;
    }
    /* let go: the new order is drawn, and the row glides the last pixels from exactly where it was let go */
    landed.current = { id: d.id, y: (row?.getBoundingClientRect().top ?? 0) };
    snapshot();
    commit(d.from, d.to, "drag");
  };

  /* a grip's drag goes through the one gesture helper: past a few pixels the row lifts (on touch only after a hold, so
     a swipe that starts on a grip still scrolls the page), and a lost pointer sends it home */
  const begin = (id: string) => {
    const i = items.findIndex((x) => x.id === id);
    if (i < 0 || items.length < 2) return;
    const rows = rowsOf();
    const rects = rows.map((r) => r.getBoundingClientRect());
    /* the gap from one row to the next, so a row that steps aside covers the whole slot */
    const slot = (k: number) => (rects[k + 1] ? rects[k + 1]!.top - rects[k]!.top : rects[k]!.height);
    drag.current = { id, from: i, to: i, dy: 0, tops: rects.map((r) => r.top), heights: rects.map((_, k) => slot(k)) };
    for (const r of rows) r.style.transition = lessMotion(list.current) ? "none" : "transform var(--ns-time-snap) var(--ns-ease-move)";
    const row = rows[i]!;
    row.style.transition = lessMotion(list.current) ? "none" : "box-shadow var(--ns-time-snap) var(--ns-ease-move), scale var(--ns-time-snap) var(--ns-ease-move)";
    setDragging(id);
  };
  const follow = (dy: number) => {
    const d = drag.current;
    if (!d) return;
    const rows = rowsOf();
    const first = d.tops[0]!, last = d.tops[d.tops.length - 1]!;
    /* it stays under the pointer, held inside the list's own length */
    d.dy = Math.min(Math.max(dy, first - d.tops[d.from]!), last - d.tops[d.from]!);
    rows[d.from]!.style.transform = `translateY(${d.dy}px)`;
    /* where it would land: after every other row whose middle it has passed */
    const mid = d.tops[d.from]! + d.dy + d.heights[d.from]! / 2;
    const to = d.tops.filter((t, k) => k !== d.from && t + d.heights[k]! / 2 < mid).length;
    if (to !== d.to) {
      d.to = to;
      lay(d);
    }
  };
  const grip = useGestures((id) => ({
    axis: "y",
    touchHold: true,
    onDragStart: () => begin(id),
    onDrag: ({ dy }) => follow(dy),
    onDragEnd: () => drag.current && end(true),
    onCancel: () => end(false),
  }));

  /* Esc while dragging sends the row home, wherever focus is */
  const endRef = React.useRef(end);
  useIsomorphicLayoutEffect(() => {
    endRef.current = end;
  });
  React.useEffect(() => {
    if (!dragging) return;
    const esc = (e: KeyboardEvent) => {
      if (e.key !== "Escape") return;
      e.preventDefault();
      endRef.current(false);
    };
    window.addEventListener("keydown", esc, true);
    return () => window.removeEventListener("keydown", esc, true);
  }, [dragging]);

  const keys = (i: number) => (e: React.KeyboardEvent) => {
    if (!e.altKey || (e.key !== "ArrowUp" && e.key !== "ArrowDown")) return;
    e.preventDefault();
    const to = e.key === "ArrowUp" ? i - 1 : i + 1;
    if (to < 0 || to >= items.length) return;
    commit(i, to, "keys");
  };

  return (
    <>
      <ul ref={list} aria-label={label} aria-describedby={hintId} data-slot="reorderable-list" data-dragging={dragging ? "" : undefined} className={cn("relative m-0 flex list-none flex-col p-0", dragging && "cursor-grabbing select-none", className)}>
        {items.map((it, i) => {
          const lifted = dragging === it.id;
          return (
            <li
              key={it.id}
              data-row={it.id}
              data-lifted={lifted || undefined}
              onKeyDown={keys(i)}
              className={cn(
                "group/row relative flex min-h-11 items-center gap-2 rounded-[var(--ns-radius-lg)] bg-[var(--ns-raised)] ps-1.5 pe-2 text-[length:var(--ns-text-body)] text-[var(--ns-ink)] will-change-transform",
                /* a hairline between rows; the lifted row drops it and floats */
                "after:pointer-events-none after:absolute after:inset-x-3 after:bottom-0 after:h-px after:bg-[var(--ns-line-soft)] after:content-[''] last:after:hidden",
                lifted && "z-[1] scale-[1.02] shadow-[var(--ns-shadow-float)] after:hidden",
              )}
            >
              <button
                type="button"
                aria-label={fill(L.grip, { label: it.label })}
                aria-describedby={hintId}
                {...grip(it.id).handlers}
                /* a mouse's press keeps the text unselected; a finger's is left alone, so the page can still scroll */
                onPointerDown={(e) => (e.pointerType !== "touch" && e.preventDefault(), grip(it.id).handlers.onPointerDown(e))}
                className={cn("grid size-8 shrink-0 cursor-grab place-items-center rounded-[var(--ns-radius-sm)] text-[var(--ns-ink-3)] outline-hidden [transition:color_var(--ns-time-color)] hover:text-[var(--ns-ink)] focus-visible:outline-2 focus-visible:outline-[var(--ns-signal)]", lifted && "cursor-grabbing text-[var(--ns-ink)]")}
              >
                <GripVertical aria-hidden className="size-[var(--ns-icon)]" />
              </button>
              <span className="min-w-0 flex-1 truncate">{it.label}</span>
              {it.detail != null && <span className="shrink-0 text-[length:var(--ns-text-small)] text-[var(--ns-ink-3)] tabular-nums">{it.detail}</span>}
              <Menu
                title={it.label}
                align="end"
                trigger={
                  /* the menu shows on the row's hover or focus, and while open; always on a touch screen */
                  <IconButton
                    size="sm"
                    intent="ghost"
                    label={fill(L.actions, { label: it.label })}
                    className="[transition:opacity_var(--ns-time-color),background-color_var(--ns-time-color)] pointer-fine:opacity-0 pointer-fine:group-hover/row:opacity-100 pointer-fine:group-focus-within/row:opacity-100 pointer-fine:aria-expanded:opacity-100 pointer-fine:data-popup-open:opacity-100"
                  >
                    <Ellipsis />
                  </IconButton>
                }
              >
                <MenuItem icon={<ArrowUp />} shortcut="⌥↑" disabled={i === 0} onClick={() => commit(i, i - 1, "keys")}>
                  {L.up}
                </MenuItem>
                <MenuItem icon={<ArrowDown />} shortcut="⌥↓" disabled={i === items.length - 1} onClick={() => commit(i, i + 1, "keys")}>
                  {L.down}
                </MenuItem>
                <MenuItem icon={<ArrowUpToLine />} disabled={i === 0} onClick={() => commit(i, 0, "keys")}>
                  {L.top}
                </MenuItem>
              </Menu>
            </li>
          );
        })}
      </ul>
      <span id={hintId} className="sr-only">
        {L.hint}
      </span>
      <span aria-live="polite" className="sr-only">
        {said}
      </span>
    </>
  );
}

export { REORDERABLE_LIST_LABELS, ReorderableList, type ReorderableItem, type ReorderableListLabels, type ReorderableListProps };
```

### lib/notchset/gesture-list.ts

```tsx
// Notchset reorderable-list 1.1.0 · https://notchset.dev/changelog
"use client";
import * as React from "react";
import { type Gesture, type GestureOptions, gestureCore, gestureStyle, touchHeld } from "@/lib/notchset/gesture";

/* a drag that waited for a hold keeps the page still once it starts: the browser waits only for a touchmove listener
   there when the touch began, so one sits on the window while a list of handles is mounted */
let guards = 0;
const guard = (e: TouchEvent) => void (touchHeld() && e.cancelable && e.preventDefault());
function touchGuard() {
  if (!guards++) window.addEventListener("touchmove", guard, { passive: false });
  return () => void (--guards || window.removeEventListener("touchmove", guard));
}

/**
 * The gesture helper for many handles a piece draws in a list (a table's headers, a row's grips, a week's blocks):
 * `of(key)` gives that key's gesture, made once and kept, with `options(key)` handed to it after every render.
 */
export function useGestures(options: (key: string) => GestureOptions): (key: string) => Gesture {
  const [all] = React.useState(() => new Map<string, ReturnType<typeof gestureCore>>());
  React.useEffect(() => all.forEach((g, key) => g.set(options(key))));
  React.useEffect(() => () => all.forEach((g) => g.stop()), [all]);
  React.useEffect(touchGuard, []);
  return (key) => {
    const o = options(key);
    const g = all.get(key) ?? all.set(key, gestureCore(o)).get(key)!;
    return { handlers: { style: gestureStyle(o), ...g.handlers }, held: g.held };
  };
}
```

### lib/notchset/gesture.ts

```tsx
// Notchset reorderable-list 1.1.0 · https://notchset.dev/changelog
"use client";
import * as React from "react";
import { lessMotion } from "@/lib/notchset/motion";

/*
 * The one pointer helper every pressable, holdable or draggable piece uses: a press that moves less than `threshold`
 * is a press; past it, a drag that captures the pointer and ends with its release velocity (0 with less motion).
 * Esc, a lost capture or a cancelled pointer cancels it. `touch-action` follows `axis`, so the page still scrolls the
 * other way. A list of handles takes one gesture per key (gesture-list).
 */

/** A drag's travel from its start and where the pointer is now, in CSS pixels. */
export type DragMove = { dx: number; dy: number; x: number; y: number };
/** A drag's end: its travel and release velocity in px/ms (0 with less motion). */
export type DragEnd = { dx: number; dy: number; vx: number; vy: number };

export type GestureOptions = {
  /** a click, a tap that moved less than `threshold`, or Enter or Space */
  onPress?: (() => void) | undefined;
  /** a touch held still for `holdMs` */
  onHold?: (() => void) | undefined;
  /** a press passes `threshold` and becomes a drag; each move; the release */
  onDragStart?: (() => void) | undefined;
  onDrag?: ((move: DragMove) => void) | undefined;
  onDragEnd?: ((end: DragEnd) => void) | undefined;
  /** Esc, a lost capture or a cancelled pointer ended the drag: put things back */
  onCancel?: (() => void) | undefined;
  /** which way the drag runs, the page scrolling the other way ("both") */
  axis?: "x" | "y" | "both" | undefined;
  /** the pixels a press travels before it drags (6); a hold's milliseconds (480) */
  threshold?: number | undefined;
  holdMs?: number | undefined;
  /** the keyboard twin: each arrow is a whole drag of this many pixels (Shift: ten times) */
  keyboardStep?: number | undefined;
  /** the piece's own keys beside it, by name with modifiers ("Alt+ArrowRight", "Alt+Shift+ArrowLeft"), run first */
  keys?: Record<string, () => void> | undefined;
  /** on touch, drag only after a hold (a moving finger scrolls until then); for a list's handles (useGestures) */
  touchHold?: boolean | undefined;
};

export type Gesture = {
  /** spread on the element: its pointer, key and click handlers and its touch-action */
  handlers: {
    style: React.CSSProperties;
    onPointerDown: (e: React.PointerEvent) => void;
    onPointerMove: (e: React.PointerEvent) => void;
    onPointerUp: (e: React.PointerEvent) => void;
    onPointerCancel: (e: React.PointerEvent) => void;
    onLostPointerCapture: (e: React.PointerEvent) => void;
    onKeyDown: (e: React.KeyboardEvent) => void;
    onClick: (e: React.MouseEvent) => void;
    onContextMenu: (e: React.MouseEvent) => void;
  };
  /** true once, for the click that ends a hold or a drag, so the element's own click can skip it */
  held: () => boolean;
};

type Press = { id: number; x: number; y: number; t: number; dragging: boolean; samples: { x: number; y: number; t: number }[] };

const TOUCH_ACTION = { x: "pan-y", y: "pan-x", both: "none" } as const;
const KEYS: Record<string, [number, number]> = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] };

/** The release velocity from the last ~80ms of moves, in px/ms, along each axis. */
export function releaseVelocity(samples: readonly { x: number; y: number; t: number }[]): { vx: number; vy: number } {
  const last = samples[samples.length - 1];
  const first = last && samples.find((s) => last.t - s.t <= 80);
  if (!last || !first || last.t === first.t) return { vx: 0, vy: 0 };
  return { vx: (last.x - first.x) / (last.t - first.t), vy: (last.y - first.y) / (last.t - first.t) };
}

/* drags under a finger after a hold (gesture-list keeps the page still meanwhile) */
let held = 0;
export const touchHeld = () => held > 0;

/** One gesture outside React (useGesture and useGestures hold one each): `set` gives it the latest options. */
export function gestureCore(first: GestureOptions) {
  let o = first, press: (Press & { armed?: boolean }) | null = null, timer: ReturnType<typeof setTimeout> | undefined, swallow = false;
  const stopHold = () => clearTimeout(timer);
  const drags = () => !!(o.onDrag || o.onDragEnd || o.onDragStart);
  const along = (dx: number, dy: number) => ({ dx: o.axis === "y" ? 0 : dx, dy: o.axis === "x" ? 0 : dy });
  const start = (el: Element, id: number) => {
    press!.dragging = true;
    el.setPointerCapture?.(id);
    o.onDragStart?.();
  };
  const end = () => {
    stopHold();
    if (press?.armed) held--;
    const p = press;
    press = null;
    return p;
  };
  const cancel = () => {
    if (!end()?.dragging) return;
    swallow = true;
    o.onCancel?.();
  };
  const handlers: Omit<Gesture["handlers"], "style"> = {
    onPointerDown: (e) => {
      if (e.button !== 0) return;
      end();
      swallow = false;
      const el = e.currentTarget, touch = e.pointerType === "touch", lift = touch && o.touchHold && drags();
      const p: Press & { armed?: boolean } = (press = { id: e.pointerId, x: e.clientX, y: e.clientY, t: e.timeStamp, dragging: false, samples: [{ x: e.clientX, y: e.clientY, t: e.timeStamp }] });
      if (touch && (o.onHold || lift))
        timer = setTimeout(() => {
          swallow = true;
          o.onHold?.();
          /* held still: the drag starts here, and the finger moves it, not the page */
          if (!lift || press !== p) return;
          p.armed = true;
          held++;
          start(el, p.id);
        }, o.holdMs ?? 480);
    },
    onPointerMove: (e) => {
      const p = press;
      if (!p || p.id !== e.pointerId) return;
      if (!p.dragging) {
        if (Math.hypot(e.clientX - p.x, e.clientY - p.y) <= (o.threshold ?? 6)) return;
        stopHold();
        if (!drags()) return;
        /* a finger that moves before the hold scrolls the page */
        if (o.touchHold && e.pointerType === "touch") return void end();
        start(e.currentTarget, e.pointerId);
      }
      p.samples.push({ x: e.clientX, y: e.clientY, t: e.timeStamp });
      if (p.samples.length > 8) p.samples.shift();
      o.onDrag?.({ ...along(e.clientX - p.x, e.clientY - p.y), x: e.clientX, y: e.clientY });
    },
    onPointerUp: (e) => {
      if (press?.id !== e.pointerId) return stopHold();
      const p = end()!;
      if (!p.dragging) return;
      swallow = true;
      /* the release point counts as the last sample, so a finger that rests before it lifts has let go still */
      const v = lessMotion(e.currentTarget) ? { vx: 0, vy: 0 } : releaseVelocity([...p.samples, { x: e.clientX, y: e.clientY, t: e.timeStamp }]);
      const { dx: vx, dy: vy } = along(v.vx, v.vy);
      o.onDragEnd?.({ ...along(e.clientX - p.x, e.clientY - p.y), vx, vy });
    },
    onPointerCancel: cancel,
    onLostPointerCapture: (e) => void (press?.id === e.pointerId && press.dragging && cancel()),
    onKeyDown: (e) => {
      if (e.key === "Escape" && press?.dragging) return e.preventDefault(), cancel();
      if ((e.key === "Enter" || e.key === " ") && o.onPress && e.target === e.currentTarget) return e.preventDefault(), o.onPress();
      const own = o.keys?.[`${e.altKey ? "Alt+" : ""}${e.shiftKey ? "Shift+" : ""}${e.key}`];
      if (own) return e.preventDefault(), own();
      const step = o.keyboardStep, dir = KEYS[e.key];
      if (!step || !dir || !drags()) return;
      const { dx, dy } = along(dir[0] * step * (e.shiftKey ? 10 : 1), dir[1] * step * (e.shiftKey ? 10 : 1));
      if (!dx && !dy) return;
      e.preventDefault();
      o.onDragStart?.();
      o.onDrag?.({ dx, dy, x: 0, y: 0 });
      o.onDragEnd?.({ dx, dy, vx: 0, vy: 0 });
    },
    onClick: (e) => {
      if (!swallow) return o.onPress?.();
      swallow = false;
      e.preventDefault();
    },
    onContextMenu: (e) => {
      if ((o.onHold || o.touchHold) && (swallow || press)) e.preventDefault();
    },
  };
  const wasHeld = () => {
    const h = swallow;
    swallow = false;
    return h;
  };
  return { handlers, held: wasHeld, set: (next: GestureOptions) => void (o = next), stop: () => void end() };
}

/** `touch-action` from the axis (the page's own pans for a drag that waits for a hold), and no selection where a
    touch is held. */
export function gestureStyle(o: GestureOptions): React.CSSProperties {
  const drags = o.onDrag || o.onDragEnd || o.onDragStart, hold = o.onHold || (o.touchHold && drags);
  return {
    touchAction: drags ? (o.touchHold ? "manipulation" : TOUCH_ACTION[o.axis ?? "both"]) : undefined,
    ...(hold && { userSelect: "none", WebkitUserSelect: "none", WebkitTouchCallout: "none" }),
  } as React.CSSProperties;
}

export function useGesture(options: GestureOptions): Gesture {
  /* the latest callbacks, read when an event comes, so the handlers never go stale between renders */
  const [g] = React.useState(() => gestureCore(options));
  React.useEffect(() => g.set(options));
  React.useEffect(() => g.stop, [g]);
  return { handlers: { style: gestureStyle(options), ...g.handlers }, held: g.held };
}

/** Press and hold on touch (a row's way in to selecting): `onHold`, else an ordinary tap; `held()` as above. No
    `onHold`, no handlers. */
export function usePressHold(onHold: (() => void) | undefined): { handlers: Partial<Gesture["handlers"]>; held: () => boolean } {
  const g = useGesture({ onHold });
  if (!onHold) return { handlers: {}, held: () => false };
  const { style, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onContextMenu } = g.handlers;
  return { handlers: { style, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onContextMenu }, held: g.held };
}
```

### lib/notchset/icons.ts

```tsx
// Notchset reorderable-list 1.1.0 · https://notchset.dev/changelog
/** Every piece imports its icons from here: swap the icon set in this one file. */
export * from "lucide-react";
```

### lib/notchset/motion.ts

```tsx
// Notchset reorderable-list 1.1.0 · https://notchset.dev/changelog
"use client";
/*
 * Less motion, the one switch every piece reads, and a motion role's timing for a Web Animation. Split from
 * physics.ts so a piece that needs only these does not carry the springs.
 */
import * as React from "react";

/**
 * Less motion where `el` sits: the device's setting, then a data-motion="reduced" on `el` or any ancestor, falling
 * back to <html>'s when there is no element. The one copy: every piece reads this.
 */
const REDUCED = '[data-motion="reduced"],[data-motion="off"]';
export function lessMotion(el?: Element | null): boolean {
  if (typeof document === "undefined") return true;
  if (typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches) return true;
  return !!(el?.closest?.(REDUCED) ?? document.documentElement.matches(REDUCED));
}

/** Less motion, kept current as the setting changes; true on a server, so a piece starts in its still. */
export function useLessMotion(): boolean {
  return React.useSyncExternalStore(
    (f) => {
      if (typeof matchMedia === "undefined") return () => {};
      const q = matchMedia("(prefers-reduced-motion: reduce)");
      q.addEventListener("change", f);
      const mo = typeof MutationObserver === "undefined" ? null : new MutationObserver(f);
      mo?.observe(document.documentElement, { attributes: true, attributeFilter: ["data-motion"] });
      return () => {
        q.removeEventListener("change", f);
        mo?.disconnect();
      };
    },
    () => lessMotion(),
    () => true,
  );
}

/** A motion role's duration and curve (0 under less motion: the result at once), read from the foundation where `el` sits, for a Web Animation that glides
    something CSS can't transition (a width to `auto`, a node on its way out): `roleTiming(el, "--ns-time-menu")`. */
export function roleTiming(el: Element, time: string, ease = "--ns-ease"): KeyframeAnimationOptions {
  if (lessMotion(el)) return { duration: 0, easing: "linear" };
  const cs = getComputedStyle(el);
  const t = cs.getPropertyValue(time).trim();
  const ms = t.endsWith("ms") ? parseFloat(t) : parseFloat(t) * 1000;
  return { duration: Number.isFinite(ms) ? ms : 0, easing: cs.getPropertyValue(ease).trim() || "linear" };
}

/** The foundation's curves as literal strings, for a Web Animation (`element.animate`, `KeyframeEffect`,
    `updateTiming`): those take a literal easing and throw on a CSS var. Copied from foundation.css's `--ns-ease-*`;
    CSS transitions and keyframes keep the vars. */
export const EASE = {
  enter: "cubic-bezier(0.22, 1, 0.36, 1)",
  move: "cubic-bezier(.5, 0, .2, 1)",
  exit: "cubic-bezier(.6, 0, .9, .5)",
  panel: "cubic-bezier(0.32, 0.72, 0, 1)",
  press: "cubic-bezier(0.2, 0, 0, 1)",
  spring: "cubic-bezier(0.16, 1, 0.3, 1)",
  arrive: "cubic-bezier(.3, 1.22, .5, 1)",
  breathe: "cubic-bezier(.45, 0, .55, 1)",
} as const;
```

### lib/notchset/words.ts

```tsx
// Notchset reorderable-list 1.1.0 · https://notchset.dev/changelog
import * as React from "react";

/* Built-in words and figures, one way for every piece. */

/** The locale a piece writes in when the app passes none: English at launch, the same on the server and in the browser. */
export const DEFAULT_LOCALE = "en-US";

/** A count's words by the locale's plural rule: `other` always, any of the locale's other forms as it needs them. */
export type Plural = { other: string } & Partial<Record<Intl.LDMLPluralRule, string>>;

/** A whole number (or any figure) in the locale's digits and grouping. */
export function formatCount(n: number, locale: string = DEFAULT_LOCALE, options?: Intl.NumberFormatOptions): string {
  return new Intl.NumberFormat(locale, options).format(n);
}

/** A sentence with its `{name}` blanks filled; a blank with no value is left as written. */
export function fill(sentence: string, vars: Readonly<Record<string, string | number>>): string {
  return sentence.replace(/\{(\w+)\}/g, (blank, name: string) => (name in vars ? String(vars[name]) : blank));
}

/** The same, where a blank is a node (a name in ink): the sentence's own words stay in order around it. */
export function fillNodes(sentence: string, vars: Readonly<Record<string, React.ReactNode>>): React.ReactNode {
  return sentence.split(/(\{\w+\})/).map((part, i) => {
    const name = /^\{(\w+)\}$/.exec(part)?.[1];
    return name !== undefined && name in vars ? React.createElement(React.Fragment, { key: i }, vars[name]) : part;
  });
}

/** A count's sentence by the locale's plural rule, `{count}` written in the locale ("1 message", "4 messages"). */
export function plural(locale: string | undefined, n: number, forms: Plural, vars: Readonly<Record<string, string | number>> = {}): string {
  const loc = locale ?? DEFAULT_LOCALE;
  const rule = new Intl.PluralRules(loc).select(n);
  return fill(forms[rule] ?? forms.other, { count: formatCount(n, loc), ...vars });
}
```

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.
