Skip to content

No.50 · Controls

Mercury Segments

A segmented control whose thumb behaves like a bead of mercury: it stretches toward the new option, sheds droplets that trail behind, and they merge back as it settles.

The prompt

Written for the variant you picked above: Mercury

Build a pill segmented control (radiogroup) whose selected thumb is liquid metal. Render the thumb as three absolutely positioned pills inside a layer filtered by an SVG goo filter (feGaussianBlur 6 → feColorMatrix alpha row '0 0 0 22 -9' → feComposite atop source): a full-size body plus two smaller droplets centred inside it. All three are positioned by left/right from two CSS variables (--ms-l, --ms-w) measured from the active button. When the value changes, the body's leading edge moves first and its trailing edge follows 110ms later (swap the delays by direction), over 460ms on cubic-bezier(0.16,1,0.3,1), so it stretches toward the new option. The droplets use longer durations (700ms, 900ms) and small delays, so they lag behind, pinch off from the body through the goo threshold, and merge back as they arrive — like a bead of mercury. Fill everything with a vertical white → tint → dark tint gradient (tint prop), and add a crisp 38%-height specular strip over the settled bead outside the filter so the text stays sharp. Labels sit above in Hanken 15px; the active one turns near-black and 600. Keyboard: roving tabindex, ←/→/Home/End select and focus. Selected variant — Mercury: tint="#c9d3de" (silver mercury); a four-option Range control — Day, Week, Month, Year — with a "showing · last week" line below.

Notes

Interaction
Click or tap an option; ←/→/Home/End move the selection.
Motion
Staggered left/right transitions (460ms body, 700/900ms droplets) through an SVG goo filter; specular strip follows at 120ms delay.
Accessibility
role=radiogroup with role=radio buttons, aria-checked and roving tabindex; the liquid layer is aria-hidden. Reduced motion snaps the thumb.
Responsive
Re-measures with a ResizeObserver; works with any number of options and label lengths.
On touch
Taps select directly; the tap highlight is suppressed.

Featured

301 components