Fireworks a person launches, drawn with ruler and compass: press and hold charges a ball, release sends a thin line up to open an exact figure that sags and fades.
Use it on a screen that marks a real moment: a press charges a shell and release sends it up. Start the finite finale from an event with finaleKey. It never runs or loops by itself.
When not to use
Too much for dense data screens, forms or error states; presses on buttons and inputs never charge it. For a single burst from a button use Confetti.
Use it on a screen that marks a real moment: the books closed, a launch shipped, midnight. Each
burst is caused by one press; the only sequence is a finite finale you start from an event (a
checklist reaching 100%, a countdown's onComplete). It never runs by itself and never loops.
Effects are visual pieces rather than controls: they do not replace the Interface components in
dashboards and forms.
Wrap the panel that is the stage. Press and hold on it: a ball sits on the baseline under the
pointer and squashes while it charges (up to 0.8 s: a higher shell, a wider figure). Release: a
thin line climbs to the pointer, brakes, and the figure opens.
import { Fireworks } from "@/components/effects/fireworks"export function YearEnd() { return ( <Fireworks className="rounded-2xl border bg-card"> <h2>Books closed for 2026</h2> ... </Fireworks> )}
Presses on links, buttons, inputs, labels and selected text never charge, so the controls on the
stage keep working. To charge from one element only, pass it as pressTarget; when it is
focusable, holding Space or Enter on it charges too. launchOn="none" turns presses off.
ref.current.launch({ x, y, size }) launches one shell to a point in viewport pixels; size is
the charge from 0 to 1. clear() removes everything. onLaunch, onBurst and onIdle follow
each step; onIdle runs when the last line has faded and the canvas is gone.
The ink defaults to your primary and chart-1 to chart-5, one colour per shell in order. In
the dark theme the lines are luminous and add up; in the light theme they are pigment, multiplied
like coloured ink on paper.
The canvas is aria-hidden, pointer-events: none and sits under the content: it never covers
text or takes a click.
Bursts are moved out of the stage's text blocks (safeArea, default "text"), and any line
that still crosses one drops to a quarter of its alpha, so the text keeps its contrast.
The figures carry no information. Announce the moment itself in your UI (a heading, a status).
No travel and no charging ball: on release the figure fades in whole at the pressed point as a
still diagram, stays 1 s and fades out, one at a time. A finale is a single figure. The component
reads usePrefersReducedMotion, so the MotionKitProvider setting applies too.
Nothing exists at rest: the canvas is created by the first press or launch and removed when the
last line fades. Device pixel ratio is capped at 2.
The simulation freezes in a hidden tab or with the stage off screen, and finishes on return. A
launch or a finale started while the stage is off screen is dropped.
Source size is checked against the 15 KB gzip budget for effects (pnpm size).
Technical sheet
Motion
calm
260 ms · bounce 0
lively
400 ms · bounce 0.3
playful
540 ms · bounce 0.45
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom.
Dependencies
motion
Triggers
press, pointer movement
Reduced motion
No travel: on release the figure fades in whole at the pressed point as a still diagram, stays 1 s and fades out; one at a time, and the finale is a single figure.
Keyboard
Space / Enter (hold, then release)
Charge and launch from a focusable pressTarget
Escape
Cancel the charge
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)