Confetti

Button that throws flat confetti on press. Pieces fly out, tumble, then fall and fade. Effects.

Open playground

About

Confetti is a React component in the Effects category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { Confetti } from "@ashutoshswamy/smoui" and set children, count, colors among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { Confetti } from "@ashutoshswamy/smoui";

<Confetti className="rounded-full bg-black px-6 py-3 text-white" onClick={ship}>
  Ship it
</Confetti>

Props 4

children

Button content.

ReactNode
count

Pieces per burst.

numberdefault 26
colors

Piece colours.

string[]
onClick

Click handler.

() => void