---
title: "Confetti"
description: "Confetti for success moments, called like a toast: confetti() from any handler throws a burst from a button or a point, on one canvas that exists only while pieces fall."
category: "Micro Interactions"
publishedAt: "2026-11-25"
updatedAt: "2026-11-25"
documentation: "https://beui.dev/micro-interactions/confetti"
markdown: "https://beui.dev/micro-interactions/confetti.md"
license: "MIT"
---

# Confetti

> Confetti for success moments, called like a toast: confetti() from any handler throws a burst from a button or a point, on one canvas that exists only while pieces fall.

## Install

```bash
npx shadcn@latest add @beui/confetti
```

## Dependencies

- `clsx`
- `lucide-react`
- `motion`
- `react`
- `tailwind-merge`

## Usage

```tsx
"use client";

import { Button } from "@/components/motion/button";
import { confetti } from "@/components/motion/confetti";

export function ConfettiUsage() {
  return (
    <Button onClick={(event) => confetti({ origin: event.currentTarget })}>
      Celebrate
    </Button>
  );
}
```

## About Confetti

Confetti is a confetti burst for React success moments that you call like a toast: confetti() from any event handler, with no provider, hook or element to mount. A burst blooms out of a button or a point: the pieces pop up and slow in the air, then tumble and sway as they drift down at a gentle, capped speed, and fade out. It draws on one canvas over the page that exists only while pieces are in the air, and overlapping bursts share it.

### When to use it

- A checkout, signup or upgrade just succeeded.
- A user finishes onboarding, a streak or a big task.
- A launch or announcement page wants a moment of delight on a button.

### Accessibility

The canvas is hidden from assistive technology and never takes pointer events, so nothing under it is blocked. Announce the success itself in text or a toast; confetti is decoration. With reduced motion confetti() draws nothing and resolves at once.

### FAQ

**How do I fire it from a button?**

Call confetti({ origin: event.currentTarget }) in the click handler, and the burst starts from the button's centre.

**Can I change the colours and size of the burst?**

Pass colors as CSS colours, count for the number of pieces, power for the launch speed, and angle and spread for the direction.

**How do I know when it has finished?**

confetti() returns a promise that resolves when the last piece has gone.

## Source

- Registry detail: https://beui.dev/r/confetti
- Raw source: https://beui.dev/r/confetti/raw
- GitHub: https://github.com/starc007/ui-components
