Particles

A burst of particles around a trigger, for likes and stars.

particles.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/particles.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/particles.json

3

Turn on the motion

npx @prequelui/cli@latest animate particles

The CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

particles.tsx
import { Particles, ParticlesEffect } from "@/components/prequelui/effects/particles";

export default function Demo() {
  const [burst, setBurst] = useState(0);
  return (
    <Particles>
      <button onClick={() => setBurst((value) => value + 1)}>Celebrate</button>
      <ParticlesEffect key={burst} side="top" count={10} radius={48} color="#f5b301" />
    </Particles>
  );
}
import { Particles } from "@/components/prequelui/particles";

export function Variant() {
  return (
    <Particles tempo={1.2}>
      …
    </Particles>
  );
}

Animation

A particles container coordinates a burst of dots around itself. Each dot leaves from one side of the container, travels to its place on a circle and shrinks back to zero, with a small stagger between neighbours.

  • Default travel: 0.8 s ease-out with a 50 ms step between particles.
  • Side and align place the burst on any edge or corner of the container.
  • The burst only plays when the container is in view and motion is allowed.
  • Particles are decorative, aria-hidden and pointer-events none.
800 ms ease-out50 ms staggerradius 30 pxaria-hidden

API Reference

Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.

Particles

PropTypeDefault
animatebooleantrue
inViewbooleanfalse
inViewOncebooleantrue
classNamestring—

ParticlesEffect

PropTypeDefault
side"top" | "bottom" | "left" | "right""top"
align"start" | "center" | "end""center"
countnumber6
radiusnumber30
spreadnumber360
durationnumber0.8
holdDelaynumber0.05
sizenumber4
colorstring"currentColor"

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026