party.js
Out-of-the-box confetti and sparkles — and the particle engine behind them.
npm install party-jsQuick to start
One call is all it takes
Give party.js an element and let the confetti burst out of it! Every option has a sensible default, so your first call fits on a single line.
import { confetti } from "party-js";
confetti(button);import { confetti, range } from "party-js";
confetti(button, { count: range(60, 90), spread: 100, startVelocity: range(1200, 2000),});Live Demo
Live Demo
Effects
Ready-made, and designed to be customized
Each built-in effect is one function with typed options. When none of them fits, build your own from the same parts.
createEffect({ origin: { x, y }, schedule: { /* ... */ }, particleInit: { /* ... */ }, behaviors: [/* ... */],});Your own effect
The built-in effects are made with
createEffect(). So is yours: pick
an emitter, samplers and behaviors.
Why party.js
What you get
Customizable all the way down
Samplers vary any value, behaviors change how particles move, and custom shapes draw whatever a canvas can.
How an effect worksNo dependencies
Nothing else to install and nothing to keep up to date. It runs on the canvas your browser already has.
InstallationTyped from the start
Written in TypeScript. Every option is typed and documented, right where you write your code.
API referenceRespects reduced motion
Effects skip when a visitor's system asks for less motion. You decide per effect whether it should play anyway.
Reduced motionPlaygrounds
Try it before you install
Tune every option with a live preview, then copy the code it generates.
Coming from v2?
v3 is a rewrite with a new API. The migration guide will help you to upgrade your code to the new version.
Ready to start?
Install it, then follow the quickstart to fire your first effect!
npm install party-js