Component packs › Keycap › Stem Toggle
The cap lifts off and tips back to show the switch; the cross stem turns to the pack colour and the cap drops back on with its new legend.
Stem Toggle is a toggle from Keycap, a component pack with 6 keyboard controls: Controls made of mechanical keyboard keys: real travel, a tactile bump and a switch LED under every cap. Price: $2 for the whole pack.
Built with: cap lift choreography, visible switch stem, bottom-out bounce.
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 |
|---|---|---|---|
checked | boolean | ||
disabled | boolean | ||
label | string | "Toggle" | Accessible name. Default "Toggle". |
legends | [string, string] | ["Off", "On"] | Cap legends for off and on. Default ["Off", "On"]. |
onChange | (checked: boolean) => void |
readonly checked: booleansetChecked(checked: boolean, silent?: boolean): voiddestroy(): voidimport StemToggle from './StemToggle';
<StemToggle />The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.
Good for: Buttons.