Overview
The Confetti component provides a fun and engaging way to celebrate user actions with customizable confetti animations. Built using the canvas-confetti library, it offers extensive customization options.Installation
This component requires additional dependencies:Usage
Basic Confetti
Confetti Button
Confetti Component Props
Options for individual confetti bursts.
Global options for the confetti instance (e.g., resize behavior).
If
true, confetti won’t start automatically on mount.Confetti Options
The number of confetti particles to launch.
The angle in degrees at which to launch the confetti.
The spread in degrees of the confetti.
The initial velocity of the confetti particles.
The rate at which confetti particles slow down.
The gravity applied to confetti particles.
The horizontal drift applied to confetti particles.
The number of animation frames the confetti should last.
The origin point (from 0 to 1) of the confetti emission.
Array of color strings in HEX format for the confetti particles.
Array of shapes for the confetti particles.
Scaling factor for confetti particle sizes.
The z-index value for the confetti canvas element.
Disables confetti for users who prefer reduced motion.
Use a Web Worker for better performance.
Whether to automatically resize the canvas when the window resizes.
Custom canvas element to draw confetti on.
If
true, confetti particles will be flat (no rotation or 3D effect).ConfettiButton Props
Options for confetti when the button is clicked.
Credits
- Built using the canvas-confetti library
- Ported from Magic UI Confetti