Component packs › Coil › Spring Toggle

Spring Toggle

The thumb flies across on a stretching coil, bounces off the far stop and latches; off, the coil pulls it home in swings.

Spring Toggle is a toggle from Coil, a component pack with 6 spring controls: Controls on real coil springs: they compress, stretch, overshoot and settle like wire does. Price: $2 for the whole pack.

Built with: coil anchored to the track, hard stops, overshoot.

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.

Spring Toggle props

PropTypeDefaultDescription
checkedboolean
disabledboolean
labelstring"Toggle"Accessible name. Default "Toggle".
onChange(checked: boolean) => void

Methods on the ref

Use it in React

import SpringToggle from './SpringToggle';

<SpringToggle />

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

More in Coil

Good for: Buttons.