Component packs › Spool › Piano Keys
Press a key and it hitches on the latch and stays down, while the key that was down is kicked back up past its rest and settles.
Piano Keys is a radio group from Spool, a component pack with 6 deck controls: Controls built from the mechanics of a tape deck: latching keys, reels, drums and a VU needle. Price: $2 for the whole pack.
Built with: latch hitch keyframes, kick-up overshoot, roving arrow keys.
Code: React and Next.js (TypeScript), Vue 3, plain HTML/CSS/JS, Tailwind CSS v4 and Motion (motion.dev). No npm packages needed. Keyboard accessible, with a reduced-motion version, in dark and light.
| Prop | Type | Default | Description |
|---|---|---|---|
options | string[] | Day, Week, Month, Year | Key labels. Default Day, Week, Month, Year. |
value | number | 0 | Index of the latched key. Default 0. |
label | string | "Range" | Accessible name of the group. Default "Range". |
onChange | (index: number, label: string) => void | ||
dark | boolean | ||
autoplay | number | false | Showcase mode: presses the next key every N ms. |
readonly value: numbersetValue(i: number, silent?: boolean): voiddestroy(): voidimport PianoKeys from './PianoKeys';
<PianoKeys />The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.
Good for: Skeuomorphic UI.