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

Copy this text

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

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 (night): theme="night": a near-black face #141217 with cream letters #efe8dc and a frost-blue crest #b9cce4, on #0b0a0d. 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: 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 behavior: Intrinsic width from its label. Touch: A tap sends the big wave from where you tapped. 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
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.