# Code input (Notchset): prompt.md (v2.0.0)

- id: `code-input` · version 2.0.0 · component · pro (Pro)
- category: Text fields
- build: one set of files for every shadcn style
- install: `npx shadcn@latest add @notchset-pro/code-input`
- npm dependencies: lucide-react@^1
- registry dependencies: utils, https://notchset.dev/r/notchset-foundation.json
- docs: https://notchset.dev/components/code-input
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

A one-time code in its own cells, one family with Phone input's slots. One real input carries it, so the phone offers it and a paste fills every cell. A wrong code shakes and clears for retyping; a right one turns the cells green and says Verified. The quiet key counts down to Resend code. Looks: plain, and show..

## 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/code-input.tsx`, `components/ui/notchset/field-parts.tsx`, `components/ui/notchset/slot-parts.tsx`; shared code: `lib/notchset/controllable.ts`, `lib/notchset/icons.ts`, `lib/notchset/motion.ts`, `lib/notchset/words.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `notchset-foundation`.
- Builds: one set of files, the same for every shadcn style.
- Exports to keep: `CODE_INPUT_LABELS`, `CodeInput`, `fieldSurface`, `clearOfKeyboard`, `useFocusRefused`, `CELL_GAP`, `KEY_SIZE`, `QUIET_KEY`, `RUN_GAP`, `SLOT_INPUT`, `SLOT_LINE`, `Slot`, `SlotTick`, `keepCaretAtEnd`, `shakeRow`, 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-bad-ink`, `--ns-beat`, `--ns-ease`, `--ns-ease-pop`, `--ns-field`, `--ns-field-edge`, `--ns-font-body`, `--ns-font-display`, `--ns-hover`, `--ns-ink`, `--ns-ink-2`, `--ns-ink-3`, `--ns-line`, `--ns-line-soft`, `--ns-ok`, `--ns-ok-ink`, `--ns-panel`, `--ns-radius`, `--ns-raised`, `--ns-signal`, `--ns-text-body`, `--ns-text-input`, `--ns-text-meta`, `--ns-text-small`, `--ns-time-color`, `--ns-time-menu`, `--ns-time-settle`, `--ns-time-snap`, `--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 { CodeInput } from "@/components/ui/notchset/code-input";
```

## Parts
- A single export that takes props.

## Match the original
- Read `components/ui/notchset/code-input.tsx`, `components/ui/notchset/field-parts.tsx`, `components/ui/notchset/slot-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
- A short code someone copies from a message: sign-in, a phone check, a recovery code.

### Not when
- A password is a Text field (type password); a long key is pasted into a Text field.

## Built from
- Controllable (shared helper, ships with it)
- Icons (shared helper, ships with it)
- Motion (shared helper, ships with it)
- Words (shared helper, ships with it)

## Mistakes
- Making each cell its own input: one real input carries the value so phones offer the code from a message
- Not passing error after a wrong code: the row only shakes and resets when told
- Using it for a password or a long key: that is Text field
- Painting the cells yourself on success: pass verified, so the green, the tick and its word carry it

## Usage

```tsx
"use client";
import * as React from "react";
import { CodeInput } from "@/components/ui/notchset/code-input";
import { PhoneInput } from "@/components/ui/notchset/phone-input";
import { useLessMotion } from "@/lib/notchset/motion";
import { useSelfPlay } from "./self-play";

/*
 * A sign-in code sent to a UK mobile. On first sight six digits drop in as from a message, the cells turn green one by
 * one and it says Verified; the quiet key under it counts down to Resend code, and once verified reads Change number.
 * The fail knob makes the next code wrong: the row shakes once, says so and clears for retyping. Showpiece sets the
 * cells at display size; Plain is the form's own; the family look sets it under the phone number it was sent to.
 * Less motion shows the code already verified.
 */
type Look = "show" | "plain" | "family";
const CODE = "284163";

export default function CodeInputDemo() {
  const look = "show" as Look;
  const fails = false;
  const label = "Code sent to +44 7700 900123";
  const root = React.useRef<HTMLDivElement>(null);
  const less = useLessMotion();
  const play = useSelfPlay(root, { beats: [0], off: less });
  const [phone, setPhone] = React.useState("+447700900123");
  const [code, setCode] = React.useState(CODE);
  const [result, setResult] = React.useState<"typing" | "wrong" | "verified">("verified");
  /* the chip is a switch: while it is on, every code is wrong */
  const failRef = React.useRef(false);
  React.useEffect(() => {
    failRef.current = fails;
  });
  /* the moment: the number types in (family), then the code drops in a digit at a time */
  React.useEffect(() => {
    if (play.step !== 0) return;
    const later: number[] = [];
    const at = (ms: number, f: () => void) => later.push(window.setTimeout(f, ms));
    const start = look === "family" ? 1750 : 0;
    at(0, () => {
      setCode("");
      setResult("typing");
      if (look === "family") setPhone("");
    });
    if (look === "family") [..."7700900123"].forEach((_, i, all) => at(100 + i * 95, () => setPhone(`+44${all.slice(0, i + 1).join("")}`)));
    [...CODE].forEach((_, i) => at(start + 450 + i * 110, () => setCode(CODE.slice(0, i + 1))));
    at(start + 450 + 5 * 110 + 260, () => setResult("verified"));
    return () => later.forEach(clearTimeout);
  }, [play.step, look]);
  const check = () => {
    window.setTimeout(() => {
      if (failRef.current) setResult("wrong");
      else setResult("verified");
    }, 260);
  };
  const codeInput = (
    <CodeInput
      key={look}
      label={label}
      look={look === "plain" ? "plain" : "show"}
      value={code}
      onValueChange={(next) => {
        setCode(next);
        if (result === "wrong") setResult("typing");
      }}
      onComplete={check}
      error={result === "wrong" ? "That code didn’t match. Type it again." : undefined}
      verified={result === "verified"}
      resend={{ onResend: () => setResult("typing"), wait: 24 }}
      onChangeNumber={() => {
        setCode("");
        setResult("typing");
      }}
    />
  );
  return (
    <div ref={root} onPointerDownCapture={play.handOver} onKeyDownCapture={play.handOver} onFocusCapture={play.handOver} className="flex w-full max-w-[640px] flex-col items-center">
      {look === "family" ? (
        <>
          <PhoneInput label="Mobile" defaultCountry="GB" look="slots" value={phone} onValueChange={setPhone} />
          <span aria-hidden className="my-9 h-px w-[min(420px,80%)] bg-[var(--ns-line-soft)]" />
        </>
      ) : null}
      {codeInput}
    </div>
  );
}
```

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

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `label` | `React.ReactNode` |  | what the code is, above the cells ("Sign-in code") |
| `length` | `number` | `6` | how many characters; 6 by default |
| `value` | `string` |  | the code typed so far (controlled, with onValueChange) |
| `defaultValue` | `string` | `""` | the code at first (uncontrolled) |
| `onValueChange` | `(value: string) => void` |  | called with the code as it is typed or pasted, every box at once |
| `onComplete` | `(code: string) => void` |  | runs once every cell is filled, with the whole code |
| `inputMode` | `"numeric" \| "text"` | `"numeric"` | numeric: digits only, the number pad; text: letters and digits, upper-cased |
| `groups` | `"halves" \| "none"` | `"halves"` | halves: a code of 6 or 8 cells reads as two short runs (3 and 3, 4 and 4), the way a code in a message is kept in mind; none: one run. A code of 4 or an odd length is always one run. |
| `look` | `"plain" \| "show"` | `"plain"` | plain: the field's height, nothing moves while typing; show: display size, each character lands in its cell |
| `hint` | `React.ReactNode` |  | a quieter line under the cells ("Sent to ana@dropbox.com") |
| `error` | `React.ReactNode` |  | a wrong code: what happened and what to do; the row shakes once and clears for retyping |
| `verified` | `boolean` | `false` | the code was accepted: the cells settle green one by one and a tick draws beside the verified words |
| `resend` | `{ onResend: () => void; wait?: number \| undefined }` |  | the quiet resend key under the cells: it counts `wait` seconds (30 by default), then sends a new code on a press |
| `onChangeNumber` | `() => void` |  | once verified, the quiet key reads "Change number" and runs this |
| `labels` | `Partial<typeof CODE_INPUT_LABELS>` |  | its built-in words in another language |
| `disabled` | `boolean` |  | stops input; pair it with a reason where the person can't tell why |
| `autoComplete` | `string` | `"one-time-code"` | read the code from the phone's messages and password managers (one-time-code by default) |
| `autoFocus` | `boolean` |  | focus the input when it mounts (a step that is only this code) |
| `name` | `string` |  | the form field the whole code submits under |

Full docs: https://notchset.dev/components/code-input

## 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 |
|---|---|
| A character | fills the next cell and moves on |
| Backspace | takes the last character and moves back |
| Paste | a whole code fills every cell; spaces and dashes are dropped |
| Tab | leaves the row |

## Performance

- One real input drawn as cells; typing updates a string, nothing else.
- Installs field with lucide-react (2 files, about 11 kB).
- Four to eight cells fit a phone.

## Responsive

- phone: the number pad or the keyboard, the code offered from a message
- desktop
- dark (tokens)
- right to left: cells keep their order (codes read left to right)

## Motion inventory

| Interaction | What moves |
|---|---|
| show: a digit drops into its cell and the cell lifts once; a paste lands 35ms apart | ns-slot-land over --ns-time-snap, ns-slot-lift 5px over --ns-time-settle, --ns-ease. Reduced motion: the digit is there (data-ns-still). |
| a wrong code shakes the row once | 6px over 300ms (WAAPI, ease-out). Reduced motion: no shake; the edges and words say it. |
| a right code: the cells turn green one by one | background-color over --ns-time-color, 55ms apart (data-ns-glide). Reduced motion: green at once. |
| then the tick pops in beside Verified and its stroke draws once | ns-pop on --ns-ease-pop and ns-tick-draw on --ns-ease, --ns-time-menu. Reduced motion: the tick is simply there (data-ns-still). |
| the lit empty cell blinks a caret | ns-caret over --ns-beat. Reduced motion: the caret stays drawn, no blink (data-ns-still). |

## Accessibility contract (preserve when editing)
- One text field named by the label, holding the code typed so far; the hint or the error is its description and the error marks it invalid.
- The cells are drawn only.

## Install

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

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/code-input.tsx`, `lib/notchset/controllable.ts`, `components/ui/notchset/field-parts.tsx`, `lib/notchset/icons.ts`, `lib/notchset/motion.ts`, `components/ui/notchset/slot-parts.tsx`, `lib/notchset/words.ts` from https://notchset.dev/r/pro/code-input.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`.

## Continue the workflow

- [Expanding search](https://notchset.dev/components/expanding-search)
- [Field](https://notchset.dev/components/field)
- [File drop](https://notchset.dev/components/file-drop)

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.
