Skip to content
party.js logoparty.js logo
party.js logoparty.js logo

party.js

Out-of-the-box confetti and sparkles — and the particle engine behind them.

npm install party-js

Quick 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);

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.

confetti()

Paper-like confetti that bursts in an upwards cone.

Confetti docs

sparkles()

Golden sparkles that burst outwards and glint.

Sparkles docs
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.

Create a custom effect

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 works

No dependencies

Nothing else to install and nothing to keep up to date. It runs on the canvas your browser already has.

Installation

Typed from the start

Written in TypeScript. Every option is typed and documented, right where you write your code.

API reference

Respects reduced motion

Effects skip when a visitor's system asks for less motion. You decide per effect whether it should play anyway.

Reduced motion
v2v3

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.

Migration guide

Ready to start?

Install it, then follow the quickstart to fire your first effect!

npm install party-jsQuickstart