← All components

Trail dots

A trail built from staggered follow durations rather than a position history. Every dot is told the same coordinate each frame; they string out because each one converges more slowly than the last.

Live props — bound to the real component

8
0.1
0.05
7
0.4
0.3

Install

npx shadcn@latest add @pointerui/trail-dots

Usage

app/page.tsx
import { CursorProvider } from "@/components/pointerui/provider";
import { TrailDots } from "@/components/pointerui/trail-dots";

export default function Page() {
  return (
    <CursorProvider>
      <TrailDots />

      <button data-cursor="grow">Hover me</button>
    </CursorProvider>
  );
}

Props

Generated from trail-dots/types.ts and the component's own defaults, so this table cannot drift from the code you are about to copy.

PropTypeDefaultDescription
countnumber8

Number of DOM layers. Each one is an element, so keep this small.

basenumber0.1

Follow duration of the leading dot, in seconds.

stepnumber0.05

Added to base for each subsequent dot. The stagger between durations *is* the trail — there is no history buffer and no per-frame position array.

sizenumber7

Diameter of the leading dot in px.

scaleFalloffnumber0.4

Diameter of the last dot as a fraction of size.

alphaFalloffnumber0.3

Alpha of the last dot. The leading dot is always fully opaque.

colorstring"var(--cursor-color, currentColor)"

Any CSS colour. Defaults to --cursor-color, falling back to currentColor — never hardcode a hex.

easestring"power3"

GSAP ease for the follow tween. Any ease string GSAP understands works — "power3", "expo.out", "circ", "none" for a linear follow.

This is the shape of the lag, where lag is its length. Changing it changes the character of the cursor more than any other prop.

Data attributes

Mark any element with one of these and this variant responds when the pointer enters it. Values it does not understand are ignored.

data-cursor="hide"
Fades the whole trail out.

Notes & caveats

  • Cost scales with count, because every dot is an element whose transform the style system resolves each frame. Past roughly a dozen followers, reach for trail-canvas.
  • There is no ring buffer and nothing to keep in sync — which is also why the trail collapses to a neat stack when the pointer stops.