Introducing Magic UI Pro - 50+ blocks and templates to build beautiful landing pages in minutes.


Docs
Confetti

Confetti

Confetti animations are best used to delight your users when something special happens

Confetti

Installation

npx shadcn@latest add "https://magicui.design/r/confetti"

Examples

Basic

Random Direction

Fireworks

Side Cannons

Stars

Custom Shapes

Emoji

Props

Confetti

PropTypeDefaultDescription
particleCountInteger50The number of confetti particles to launch
angleNumber90The angle in degrees at which to launch confetti
spreadNumber45The spread in degrees of the confetti
startVelocityNumber45The initial velocity of the confetti
decayNumber0.9The rate at which confetti slows down
gravityNumber1The gravity applied to confetti particles
driftNumber0The horizontal drift applied to particles
flatBooleanfalseWhether confetti particles are flat
ticksNumber200The number of frames confetti lasts
originObject{ x: 0.5, y: 0.5 }The origin point of the confetti
colorsArray of Strings['#26ccff', '#a25afd', '#ff5e7e', '#88ff5a', '#fcff42', '#ffa62d', '#ff36ff']Array of color strings in HEX format
shapesArray of Strings['square', 'circle']Array of shapes for the confetti
zIndexInteger100The z-index of the confetti
disableForReducedMotionBooleanfalseDisables confetti for users who prefer no motion
useWorkerBooleantrueUse Web Worker for better performance
resizeBooleantrueWhether to resize the canvas
canvasHTMLCanvasElement or nullnullCustom canvas element to draw confetti
scalarNumber1Scaling factor for confetti size

ConfettiButton

PropTypeDefaultDescription
optionsObject{}Options for the confetti
childrenReact.ReactNodenullChildren to render inside the button

Credits