npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-custom-confetti

v1.0.4

Published

Zero-dependency canvas confetti engine with a React component and imperative hook. Fully customizable — physics, shapes, colors, emitters.

Readme

react-confetti-engine 🎉

Zero-dependency canvas confetti — physics-based, fully customizable, React-ready.


Install

npm install react-confetti-engine
# or
yarn add react-confetti-engine

Quick start

Imperative (hook)

import Confetti, { useConfetti } from 'react-confetti-engine';

function App() {
  const { ref, burst, cannon, rain, firework, sides, clear } = useConfetti();

  return (
    <div style={{ position: 'relative', height: 500 }}>
      <Confetti ref={ref} />
      <button onClick={() => burst(400, 200)}>🎉 Burst</button>
    </div>
  );
}

Declarative (prop-driven)

<Confetti
  trigger="firework"
  active={showConfetti}
  x={0.5} // 0–1 fraction of canvas width
  y={0.3} // 0–1 fraction of canvas height
/>

Triggers

| Method / trigger prop | Description | | --------------------------- | ----------------------------- | | burst(x, y) | Radial explosion from point | | cannon('left' \| 'right') | Angled spray from screen edge | | sides() | Both cannons at once | | rain() | Curtain fall from top | | firework(x, y) | Starburst pattern + sparks | | fountain(x, y)stop() | Continuous upward spray | | clear() | Remove all particles |


Config

Pass as config prop or second arg to new ConfettiEngine(canvas, config).

{
  // Physics
  gravity: 0.35,          // downward pull per frame
  drag: 0.984,            // air resistance (0–1)
  wind: 0,                // horizontal push (+right / -left)

  // Particles
  count: 120,             // particles per trigger
  sizeMin: 5,
  sizeMax: 13,
  lifetimeMin: 2800,      // ms
  lifetimeMax: 5000,
  scalar: 1,              // global size multiplier

  // Appearance
  shapes: ['rect', 'circle', 'star', 'triangle', 'ribbon'],
  colors: ['#FF6B6B', '#FFE66D', ...],

  // Velocity
  spread: 80,             // cannon spread angle (degrees)
  startVelocity: 14,      // base speed in px/frame

  // Fade
  fadeEdge: 0.2,          // bottom fraction where alpha fades
  fadeLife: 0.75,         // lifetime fraction when alpha fade starts
}

All config keys can be overridden per-trigger:

burst(x, y, {
  colors: ['#1DB954', '#fff'],
  count: 200,
  shapes: ['star', 'circle'],
});

Vanilla JS

import { ConfettiEngine } from 'react-confetti-engine';

const canvas = document.getElementById('canvas');
const engine = new ConfettiEngine(canvas, { gravity: 0.4 });

engine.burst(canvas.offsetWidth / 2, 200);
engine.firework(400, 150);

// cleanup
engine.destroy();

Component props

| Prop | Type | Default | Description | | --------------- | --------- | ---------------- | --------------------------------------------------------------------------------------------- | | config | object | DEFAULT_CONFIG | Merged with defaults | | trigger | string | — | 'burst' \| 'cannon-left' \| 'cannon-right' \| 'sides' \| 'rain' \| 'firework' \| 'fountain' | | active | boolean | false | Fires trigger on true edge | | x | 0–1 | 0.5 | Horizontal origin fraction | | y | 0–1 | 0.4 | Vertical origin fraction | | triggerConfig | object | {} | Per-trigger config overrides | | className | string | — | Applied to <canvas> | | style | object | — | Inline style for <canvas> |


License

MIT