∞ forever components

Buttons & Toggles

Confetti Burst

Magenta pill button fires 26 colorful confetti squares and circles in a physics arc on click; bursts autonomously until first deliberate input every 2.3 s as an autonomous preview until first deliberate input loop.

cssmedium complexityintense motionclickmobile-ready

Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited

Live demo — the real component, running in a sandbox. One self-contained HTML file, zero dependencies. Open it on the canvas →
1

When to use it

CTA buttons, success states, celebration moments, onboarding rewards where a burst of delight reinforces the action.

When not to

Passive display contexts or forms requiring focus — delete the auto-loop timer before shipping to production.

Working with an AI agent

Every component ships agent-ready metadata. An example instruction for this one:

Change particle count to 40, swap colors to ["#facc15","#fb923c","#f43f5e","#ffffff"], and slow the idle interval to 4000ms. 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. Autonomous preview ends at first deliberate input and never resumes.

Safe to edit

  • particle count (count=26)
  • color palette (colors array)
  • idle interval (2300ms) Autonomous preview ends at first deliberate input and never resumes.
  • velocity range (40+90)
  • gravity coefficient (220*prog*prog)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • IIFE wrapper
  • visibilitychange stop/loop guard
  • prefers-reduced-motion count reduction and duration skip
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
  • 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

  • Auto-cycles by default — remove loop() call before production use
  • Particles are appended inside the button element, so large counts can briefly bloat the DOM
  • No aria-live announcement for the burst event
  • State remains local to each mounted instance; format/theme remount preserves takeover, not component values.

confettiburstparticlesbuttonclickphysicscelebration

More Buttons & Toggles components

  • Magnetic ButtonDark pill button drifts in an idle orbital float; cursor proximity pulls it magnetically with a label inner-parallax and emerald-to-copper glow on hover.…
  • Gooey Liquid TogglePill toggle where an SVG goo-filtered blob stretches and merges as it slides from off to on, shifting grey to magenta. Auto-cycles as demo.
  • Morphing Action FABGradient FAB whose plus icon rotates 135° to an X on click, fanning six icon buttons outward in a staggered radial spring animation. Auto-cycles in demo mode.
  • 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 PulseAmber pill button on near-black that breathes a bright neon bloom via opacity pulse on a pseudo-element; hover shifts background and text color.
  • Jelly PressAurora-gradient button squashes and stretches with a spring keyframe animation on click; cycles autonomously until first deliberate input idle squish…