Cursor Trail
ComponentsCursor Trail
ExperimentsNew

Cursor Trail

Leave a little art wherever curiosity goes. A trail of prints that follows your next move.

React + CSS
LEAVE THE ORDINARY BEHIND.

Make a
little scene.

+01 / X
+02 / Y
MOVE THROUGH THIS SPACE. LEAVE SOMETHING GOOD.
Live component. Go ahead, interact.
01

Installation

Run this in your shadcn-configured React project. The component and stylesheet are added together.

TERMINAL
npx shadcn@latest add http://localhost:5173/r/cursor-trail.json

This command uses the current site address. For localhost, keep this preview running on the same computer. Files follow your configured components alias.

02

Usage

Import the component and make the details your own.

TypeScript
import { CursorTrail } from '@/components/anticraft/CursorTrail';

export function Example() {
  return (
    <CursorTrail items={[
      { id: 'sun', label: 'Orange sun print', content: <span style={{ display: 'grid', placeItems: 'center', width: '100%', height: '100%', background: '#e88355', fontSize: 60 }}>☀</span> },
      { id: 'flower', label: 'Purple flower print', content: <span style={{ display: 'grid', placeItems: 'center', width: '100%', height: '100%', background: '#c9b7e3', fontSize: 60 }}>✳</span> },
    ]} spacing={60} lifetime={1400}>
      <p style={{ textAlign: 'center', padding: 48 }}>Make a little scene.</p>
    </CursorTrail>
  );
}
03

Props

PropTypeDefaultDescription
itemsCursorTrailItem[]RequiredPrints with a unique id, accessible label, and decorative ReactNode content. Artwork fills each print.
childrenReactNode—The content behind the prints. Its links and controls remain interactive.
spacingnumber60The distance in pixels between pointer stamps.
lifetimenumber1400How long a moving print stays visible, in milliseconds.
maxVisiblenumber8The maximum number of prints kept on the field.
classNamestring''Additional classes. Set --ac-trail-height and --ac-trail-stamp-width to size the field and prints.
04

Motion & accessibility

Considered by default.

A fine pointer leaves prints after a distance threshold. Tap the field or use Stamp artwork for a keyboard alternative; Clear trail removes all prints. Decorative prints do not intercept controls. Reduced motion disables pointer tracking and animation; manual stamps remain still.

Use semantic content and meaningful labels in your composition. Check contrast and keyboard behavior with your own styles and content.