Skip to content

No.09 · Buttons

Dissolve Button

Press it and it comes apart into hundreds of small squares that drift up and scatter, then gather again into the finished state.

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 an async action button that dissolves while the work runs. On press, hide the pill and replace it with particles on a canvas overlay (60px margin all round): one 3.4px square per 4px cell inside the pill's rounded shape, in its colour. Each particle drifts up and outward with its own random velocity, slowed by drag and pulled slightly upward, starting staggered from left to right (up to 140ms) and fading over 900ms, so the button seems to blow away like dust. Meanwhile the action runs; once it resolves (and at least 650ms have passed) every particle returns to its own cell (lerp 0.16 per frame) in the success colour, and when all have landed the canvas clears and the pill reappears green with the done label rising in. After 1.8s it resets. aria-busy is set while it's apart, and a hidden status announces "Working…" then the result. Reduced motion skips the particles and just shows the result. Selected variant — Night (night): Apply the night theme. Where the brief above gives no colour values for it, choose a restrained night 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: Press to start the action; the button dissolves while it runs and reforms when it's done. Motion: Scatter up to 900ms with a 140ms left-to-right stagger; reform lerp 0.16; label rise 360ms; reset after 1.8s. Accessibility: A real button with aria-busy during the work and a role="status" announcement of the result; the canvas is aria-hidden. Reduced motion shows the state change without particles. Responsive behavior: Sized by its label; works at any width. Touch: Taps work normally; pointer-only effects are skipped 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
Press to start the action; the button dissolves while it runs and reforms when it's done.
Motion
Scatter up to 900ms with a 140ms left-to-right stagger; reform lerp 0.16; label rise 360ms; reset after 1.8s.
Accessibility
A real button with aria-busy during the work and a role="status" announcement of the result; the canvas is aria-hidden. Reduced motion shows the state change without particles.
Responsive
Sized by its label; works at any width.
On touch
Taps work normally; pointer-only effects are skipped on touch.