Skip to content

No.85 · Controls

Gel Toggle

A switch whose thumb is a drop of gel: it stretches as it leaves, squashes when it lands, and the track fills behind it with a wobbling meniscus.

The prompt

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

Written for the variant you picked above: Paper

Build a toggle switch (<button role="switch" aria-checked>, 84×44px) whose thumb behaves like a drop of gel, in CSS plus one SVG filter. The thumb is two white circles — a head (34px) and a slightly smaller tail — inside a layer filtered by a goo filter (feGaussianBlur 4 → feColorMatrix alpha row "0 0 0 22 −10"), with a soft drop shadow after it. Switching moves both with translate, but the head leaves first (380ms) and the tail follows later and slower (520ms, 70ms delay), so while they travel the filter draws a gooey bridge between them and the drop visibly stretches; when the head lands it plays a squash keyframe (1.12 × 0.86 → 0.94 × 1.06 → 1). Two identical keyframes alternate on each switch, so the squash replays without remounting. Under the drop, the track (pale grey with an inset shadow) fills with the accent colour from the left on a springy curve (cubic-bezier(0.3,1.25,0.4,1)); the fill's leading edge is a rounded bulge that wobbles (a short stretch-and-settle keyframe) as it arrives, like a meniscus. A crisp highlight outside the filter rides on the head, so the drop stays glossy. Controlled or uncontrolled, accent colour as a prop. Demo: a settings list with three switches in different accents. Selected variant — Paper (paper): Apply the paper theme. Where the brief above gives no colour values for it, choose a restrained paper palette with text at 4.5:1 contrast or better. Keep the geometry, states and motion described above unchanged. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Click, tap, Space or Enter flips the switch. Motion: Head 380ms, tail 520ms with a 70ms delay; landing squash 560ms; fill 520ms springy with a 700ms meniscus wobble. Accessibility: A real switch with aria-checked and an accessible label (the row's visible text). Reduced motion removes the travel and squash. Responsive behavior: Fixed control size; sits at the end of settings rows at any width. Touch: Works the same on touch. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

Notes

Interaction
Click, tap, Space or Enter flips the switch.
Motion
Head 380ms, tail 520ms with a 70ms delay; landing squash 560ms; fill 520ms springy with a 700ms meniscus wobble.
Accessibility
A real switch with aria-checked and an accessible label (the row's visible text). Reduced motion removes the travel and squash.
Responsive
Fixed control size; sits at the end of settings rows at any width.
On touch
Works the same on touch.