Cursor

A custom cursor and a trailing label with two different springs.

cursor.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/cursor.json

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

3

Turn on the motion

npx @prequelui/cli@latest animate cursor

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.

cursor.tsx
import { Cursor } from "@/components/prequelui/cursor";

export default function Demo() {
  return (
    <Cursor>
      {/* compose the parts exactly like the underlying primitive */}
    </Cursor>
  );
}
import { Cursor } from "@/components/prequelui/cursor";

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

Animation

The point is glued to the pointer with no lag; the label trails behind on a softer spring. The two use different stiffness values on purpose, so the cursor feels precise while the label feels elastic.

  • Cursor entry: 550 / 30 with restSpeed 10.
  • Label follow: 500 / 50 with no bounce.
  • Touch pointers are ignored entirely.
  • Leaving the parent fades the cursor out without a jump.
spring 500 / 50pause off-screenpointer-awareinterruptible

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.

Cursor

PropTypeDefault
childrenReactNode—
disabledbooleanfalse
transitionTransitionspring.press
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026