Component packs › Ferro › Magnet Toggle
The knob is a magnet: switch on and the steel balls in the track jump up and cling to it; switch off and they drop, bounce and roll home.
Magnet Toggle is a switch from Ferro, a component pack with 7 components: Components that behave like magnets. Price: $5 for the whole pack.
Built with: ball physics, cling and drop, role switch.
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 |
|---|---|---|---|
label | string | Row label. | |
hint | string | Second line under the label. | |
checked | boolean | Start on. | |
onChange | (on: boolean) => void | Called when the value changes. | |
autoplay | boolean | Showcase mode: flips by itself until touched. |
readonly checked: booleanset(on: boolean): voiddestroy(): voidimport MagnetToggle from './MagnetToggle';
<MagnetToggle />The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.
Good for: Micro-interactions.