Buttons & Toggles
Hold-to-Shatter CTA
Press-and-hold destructive button that vibrates as it charges, then bursts into shards at full charge, with a reconstruct control.
css+canvasmedium complexitymoderate motionclickaccessible
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
1
When to use it
Destructive or irreversible actions (delete, purge, reset) where a deliberate press-and-hold is safer than a single tap.
When not to
Routine or frequent actions, or contexts where users cannot hold a press; keyboard and assistive-tech activation runs one automatic charge instead.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Edit the strings (HOLD TO VAPORIZE, the hint lines, RECONSTRUCT), the charge rate in tick() (progress + 2.2 per frame), the shard count in spawn(), and the accent via --hts-accent. Hold with pointer or Space/Enter; a plain click from assistive tech runs one full charge. Keep the demo-v1 lifecycle and the reconstruct button. Theme: dark tokens live in :root, the light variant in :root[data-theme="light"]; ?theme=light or a {type:'forever:theme'} postMessage switches at runtime.
Safe to edit
- button label and hint strings
- charge rate (progress step in tick())
- shard count and size (spawn())
- accent and surface (--hts-accent, --hts-surface, --hts-soft)
- reset button label
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- native <button> controls with aria-pressed on the main button
- keyboard hold on Space/Enter and the click fallback for assistive tech
- the reconstruct button
- prefers-reduced-motion guard (fewer shards, faster charge, no shake)
- visibilitychange pause
- demo-v1 preview lifecycle: initialize demoEnabled from window.__foreverPreview and stop attract work on the window forever:interactive event; retain manual feedback, settling, cleanup and explicit sessions
Known limitations
- State remains local to each mounted instance; format/theme remount preserves takeover, not component values.
- Rests until used (owner rule, 2026-11-21): the idle demo runs only when a host sets window.__foreverPreview.demoEnabled to true, such as the preview Forever button. The first input still stops it for good.
More Buttons & Toggles components
- Magnetic ButtonGraphite pill key with a jade rim on hover; it drifts in an idle orbital float and is pulled magnetically toward the cursor with a label inner-parallax.…
- Gooey Liquid TogglePill toggle where an SVG goo-filtered blob stretches and merges as it slides from off to on, shifting from grey to madder rose.
- Morphing Action FABDomed saffron FAB whose plus icon rotates 135° to an X on click, fanning six machined icon discs outward in a staggered radial spring animation. Physical…
- Material RippleDark rounded button that spawns an expanding ink ripple from the tap point; idles by firing ripples from random positions every 1.5 s.
- Neon Glow PulseNeon-gas tube button: orange-red tube with a hot near-white core on a brushed steel backplate with two-layer shadow, standoff clips and a faint…
- Jelly PressAurora-gradient button squashes and stretches with a spring keyframe animation on click; cycles autonomously until first deliberate input idle squish…