Capsule Toggles, animated React component
Switches built as a ball sealed in a glass capsule. Flip one and the ball stretches into a pill mid-flight, then takes on the row's colour and glows as it lands.
- Pro
- Inputs & Controls
- Spring
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
Controls
- Wi-FiHome network
- BluetoothOff
- FocusUntil 6 PM
- Low PowerOff
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| rows | CapsuleToggleRow[] | Wi-Fi, Bluetooth, Focus, Low Power | CapsuleToggles: rows as { id, label, hint, color, on }. |
| title | string | "Controls" | CapsuleToggles: small heading above the list. |
| autoplay | boolean | false | CapsuleToggles: flips the rows one after another until someone touches the panel. |
| checked | boolean | required | CapsuleToggle: whether the switch is on. |
| onChange | (v: boolean) => void | required | CapsuleToggle: called with the new value when pressed. |
| label | string | required | CapsuleToggle: accessible name of the switch. |
| onColor | string | "#34c759" | CapsuleToggle: ball colour and glow when on. |
| offColor | string | theme grey | CapsuleToggle: ball colour when off; defaults to a grey that adapts to dark mode. |