Skip to Content
zjkm-ui
Components

Particle Trail

Particles that trail behind the cursor.

ProPro, coming soon.

Draw with your pointer

Props
3
<ParticleTrail>
  <Hero />
</ParticleTrail>

Get notified

Particle Trail is a Pro effect. Join the waitlist and we'll email you when it's available.

Usage

Colourful sparks burst from the pointer as it moves, drift down and fade. It draws on a canvas, and the drawing stops while it's off-screen or the tab is hidden. Without canvas support, your content shows on its own.

import { ParticleTrail } from "@zjkm/pro/particle-trail";

export function Hero() {
  return (
    <ParticleTrail className="rounded-2xl bg-neutral-950 p-16">
      <h1 className="text-white">Leave a trail</h1>
    </ParticleTrail>
  );
}

Props

PropTypeDefaultDescription
childrenReactNodeContent shown over the sparks.
colorsstring[]pink, violet, sky, yellowSpark colours, picked at random.
densitynumber3Sparks per pointer movement.
classNamestringClasses for the wrapper.

With reduced motion, it draws one still frame and doesn't react to the pointer.

On this page