Confetti
A physics-based particle burst animation component built on top of canvas-confetti, supporting multiple presets and colors.
import
import { Confetti } from "@/components/ui/confetti/confetti";$
npx @bloomui-react/cli add confetticonfetti.tsx
Default
Trigger a single burst from the center of the screen.
fire: boolean | numbervariant:
cannon | fireworks | shower | school-pridePresets
Try out the different preset physics patterns: fireworks, falling shower, or themed school pride colors.
variant:
cannon | fireworks | shower | school-prideCustom Colors
Pass a list of hex codes to the colors prop to change the palette of the particles.
colors: string[]
Density & Spread
Configure the particleCount and spread to control the size and direction of the explosion.
particleCount: numberspread: number
Wind & Gravity
Fiddle with gravity (weight) and drift (wind speed) to float particles sideways.
gravity: numberdrift: numberstartVelocity: number
Particle Scale
Use the scalar prop to adjust the size of the individual confetti particles.
scalar: number
API Reference
Props — Confetti
Detailed specification of the Confetti component properties.
| Prop | Type | Default | Description |
|---|---|---|---|
| fire | boolean | number | true | Triggers a new animation burst when the value changes or is set to true. |
| variant | "cannon" | "fireworks" | "shower" | "school-pride" | "cannon" | The layout movement preset of the confetti particles. |
| particleCount | number | 100 / 50 | Total number of confetti particles per burst. |
| spread | number | 70 | Angle range spread of the burst particles in degrees. |
| colors | string[] | undefined | Custom color hex string array for particles. |
| angle | number | 90 | Angle direction from which particles rise (e.g. 90 is straight up). |
| startVelocity | number | 45 | Initial speed of launched particles (higher values shoot faster/higher). |
| decay | number | 0.9 | Friction factor determining how fast particles slow down. |
| gravity | number | 1 | Gravity factor pulling particles downwards. Decreasing floats particles longer. |
| drift | number | 0 | Sideways drift force simulating wind direction effects. |
| ticks | number | 200 | Lifetime limit of animation frames before particles disappear. |
| scalar | number | 1 | Scaling size multiplier of the confetti particles. |
| zIndex | number | 100 | CSS z-index of the confetti rendering canvas layer. |
| options | confetti.Options | undefined | Standard options passed directly to the canvas-confetti library. |
| onComplete | () => void | undefined | Callback fired when a particle burst completes. |