Component packs › Keycap › Stem Toggle

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.

Stem Toggle props

PropTypeDefaultDescription
checkedboolean
disabledboolean
labelstring"Toggle"Accessible name. Default "Toggle".
legends[string, string]["Off", "On"]Cap legends for off and on. Default ["Off", "On"].
onChange(checked: boolean) => void

Methods on the ref

Use it in React

import StemToggle from './StemToggle';

<StemToggle />

The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.

More in Keycap

Good for: Buttons.