Fluid Cursor Trail

Canvas particle trail that follows the cursor. Fixed overlay, customizable color, physics, and particle count.

Component

Decorative cursor trail

Move your cursor here — trail appears in this area only

Installation

pnpm dlx shadcn@latest add "https://pulkitxm.com/components/fluid-cursor-trail.json"

Usage

Import

Add the FluidCursorTrail import.

import { FluidCursorTrail } from "@/components/fluid-cursor-trail";

Use

Add to layout for site-wide effect.

<FluidCursorTrail />;

Guidelines

  • bound=false (default): full-screen fixed overlay. Add to root layout for site-wide effect.
  • bound=true: trail limited to parent container. Parent needs position: relative; use absolute inset-0 on the wrapper.
  • velocity: initial particle spread. gravity: downward acceleration. fadeSpeed: opacity decay per frame.

Props

All props are optional unless marked required. Use these to customize every aspect of the component.

PropTypeDefaultDescription
classNamestringAdditional CSS classes for the canvas.
colorstring"#8b5cf6"Particle color (hex or CSS color).
particleCountnumber3Particles spawned per mousemove.
particleSizenumber4Particle radius in pixels.
velocitynumber4Initial particle velocity spread.
gravitynumber0.2Downward gravity applied each frame.
fadeSpeednumber0.02Opacity decrease per frame (fade speed).
zIndexnumber9999z-index of the overlay.
boundbooleanfalseWhen true, trail is limited to the parent container instead of full screen.

Examples

Basic

Add to layout for site-wide cursor trail.

Decorative cursor trail

Move your cursor here — trail appears in this area only

import { FluidCursorTrail } from "@/components/fluid-cursor-trail";

export default function Layout({ children }) {
  return (
    <>
      {children}
      <FluidCursorTrail />
    </>
  );
}

Bound to container

Trail limited to container. Use bound with a relative parent.

Decorative cursor trail

Move your cursor here — trail appears in this area only

import { FluidCursorTrail } from "@/components/fluid-cursor-trail";

<div className="relative h-64">
  <FluidCursorTrail bound />
  <div className="relative flex h-full items-center justify-center">
    Content
  </div>
</div>;

Full screen

Full-screen trail with custom color and particle settings.

Decorative cursor trail

Move your cursor here — trail appears in this area only

import { FluidCursorTrail } from "@/components/fluid-cursor-trail";

<FluidCursorTrail
  color="#10b981"
  particleCount={5}
  particleSize={6}
/>;

Physics & layering

Faster particles, stronger gravity, quicker fade, custom z-index.

Decorative cursor trail

Move your cursor here — trail appears in this area only

import { FluidCursorTrail } from "@/components/fluid-cursor-trail";

<FluidCursorTrail
  color="#f43f5e"
  velocity={8}
  gravity={0.3}
  fadeSpeed={0.03}
  zIndex={50}
/>;

Made with ❤️ by Pulkit & Cursor :)

© 2026 Pulkit. All rights reserved

DMCA Verified

Last updated: