Skip to content

No.19 · Buttons

Swell Button

A pill whose label moves like water: the letter under your cursor lifts first and its neighbours follow, so a swell runs outward both ways along the word; click sends a bigger wave from where you pressed.

The prompt

Written for the variant you picked above: Night

Build a pill button whose label is split into inline-block letters. On pointerenter, find the letter whose centre is nearest the pointer and give every letter an animation delay of |i − that index| × 38ms, then restart a short keyframe (remove the attribute, force a reflow, set it again): lift 4px and tint to the crest colour at 35%, dip 1px at 70%, settle. Because the delay grows with distance, a swell runs outward from the letter you're on in both directions. On click, do the same from the pressed letter with a bigger wave (lift 7px, scale 1.08, 760ms) as confirmation. Keyboard focus and Enter start from the middle letter. The ring takes the crest colour on hover with a soft 4px halo. The button keeps its whole label as aria-label; the letters are aria-hidden. Selected variant — Night: theme="night": a near-black face #141217 with cream letters #efe8dc and a frost-blue crest #b9cce4, on #0b0a0d.

Notes

Interaction
Hover to start a swell from the letter under your cursor; click to send a bigger wave from where you pressed.
Motion
Swell 560ms per letter, 38ms per letter of distance; click wave 760ms.
Accessibility
A real button named by its full label; the split letters are aria-hidden so it's read as one word. Focus starts a swell from the middle and shows an outline. Reduced motion turns the waves off.
Responsive
Intrinsic width from its label.
On touch
A tap sends the big wave from where you tapped.

Featured

301 components