Skip to content

← Blog

better-react-confetti: Lightweight Confetti for React

June 28, 2026 · 4 min read

A quick look at better-react-confetti, a small canvas-based React confetti package with custom colors, shapes, gravity, wind, speed, and React 19 support.

A small celebration component that stays out of the way

Confetti is one of those details that can make a product moment feel finished: a successful import, a completed onboarding step, a streak milestone, a launch day button. The problem is that celebration effects often bring more surface area than the moment deserves.

better-react-confetti keeps the API intentionally small. It renders a canvas inside a normal React component, accepts practical props like total, colors, gravity, wind, speed, and recycle, and lets you pass built-in shape components when you want a more controlled visual system.

That makes it a good fit for apps that want a quick celebratory effect without adding a large animation stack or designing a canvas engine from scratch.

Try it

The demo below uses the package directly and shows profiling results from the same workload: 700 particles for 12 seconds in isolated Playwright sessions at a 1440x900 viewport.

Canvas confetti without the ceremony

Profiling results for 700 particles over 12 seconds at 1440x900.

Metric
@tholman/confetti
better-react-confetti
Improvement
DOM nodes
2,123
24
Confetti nodes
1,401
0
JS heap used
5.44 MB
2.27 MB
Avg frame
16.9ms
8.33ms
P95 frame
25.1ms
9.3ms
Dropped frames
43
0
React render
23.5ms
2ms
pnpm add better-react-confettinpm

What the package gives you

The package exports a default Confetti component plus Rectangle, Circle, and Triangle shape helpers. You can let it randomize shapes from a colors array, or pass your own ordered shape list through the Component prop for a more branded result.

The performance comparison is against @tholman/confetti. In the profiler run, better-react-confetti reduced total DOM nodes from 2,123 to 24, lowered JS heap use from 5.44 MB to 2.27 MB, and dropped React render time from 23.5ms to 2ms. The key architectural difference is that better-react-confetti keeps particle state in typed arrays and paints to one canvas instead of asking React and the DOM to manage every particle.

The current npm release is 0.1.0, supports React and React DOM from 18.3 through 19, and has no runtime dependencies. Install it with pnpm add better-react-confetti, npm install better-react-confetti, or yarn add better-react-confetti.

  • · total controls how many pieces are generated
  • · colors sets the palette when shapes are randomized
  • · gravity, wind, and speed tune the motion
  • · recycle switches between a continuous fall and a one-time burst
  • · Component accepts Rectangle, Circle, Triangle, or an array of those shapes

When I would reach for it

I would use better-react-confetti for contained product moments: a completed setup checklist, a successful share, a paid invoice, a shipped deploy, or any state transition where the user deserves a little feedback without the interface becoming noisy.

Because the component is canvas-based and pointer-events are disabled by default, it can sit on top of existing UI without blocking controls. The main engineering habit is to keep the confetti container bounded and intentional. Full-page confetti is fun once; scoped confetti is easier to keep tasteful.

Key takeaways

better-react-confetti is a practical React package for adding lightweight celebration effects without much integration cost.

  • · It uses a canvas layer, so the parent container should be positioned and sized deliberately
  • · The API is prop-driven and easy to tune for one-time bursts or continuous motion
  • · Built-in shape helpers make custom branded confetti straightforward
  • · React 19 compatibility makes it fit cleanly into modern Next.js apps
  • · Small celebration effects work best when tied to meaningful user progress