Command Palette

Search for a command to run...

Docs
Phantom Cursor

Phantom Cursor

Cursor-following trail effect with customizable dot, text, or emoji trails

Move your cursor here

Installation

Examples

Ghost Emoji Trail

Move your cursor here

Ghost emojis that follow cursor direction with random floating movement — a playful interactive effect.

Usage

import PhantomCursor from "@/components/motionx/phantom-cursor";

Dot trail

<div className="w-full h-[400px] relative">
  <PhantomCursor
    text="●"
    spacing={60}
    maxPoints={12}
    exitDuration={0.8}
    followMouseDirection={false}
    trailClassName="text-5xl text-primary/60"
  />
</div>

Emoji trail

<div className="w-full h-[400px] relative">
  <PhantomCursor
    text="👻"
    spacing={80}
    maxPoints={8}
    followMouseDirection={true}
    trailClassName="text-4xl drop-shadow-lg"
  />
</div>

Custom text trail

<div className="w-full h-[400px] relative">
  <PhantomCursor
    text="MotionX"
    spacing={120}
    maxPoints={4}
    followMouseDirection={true}
    trailClassName="text-lg font-bold text-primary/40"
  />
</div>

Props

PropTypeDefaultDescription
textstring"●"Content rendered at each trail point
delaynumber0.01Opacity animation delay in seconds
spacingnumber100Minimum distance (px) between trail points
followMouseDirectionbooleantrueRotate trail items to match cursor direction
randomFloatbooleantrueAdd random floating movement to trail items
exitDurationnumber0.5Fade-out duration when trail items disappear
removalIntervalnumber30Interval (ms) for removing stale trail points
maxPointsnumber5Maximum number of simultaneous trail points
trailClassNamestring""Custom CSS classes for each trail item

Note: The component requires a parent container with explicit dimensions. It fills 100% of its parent using w-full h-full.