Skip to content

Custom Cursor

Inside an area, the pointer becomes the Agent Cursors arrow with your name, a dot that grows into a label over links and cards, or a crosshair with coordinates. It follows with a light spring. On touch screens and with reduced motion the area keeps the normal cursor, and inputs always do.

On this page
Used for
  • Agent cursor demos
  • Gallery hover labels
  • Canvas tools
  • Product showcases

Examples

Variant

Opting out

Installation

npx knowns-ui@latest add custom-cursor
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

variant
"arrow" | "dot" | "crosshair"
Default"arrow"
Arrow with a name pill, a dot that becomes a label, or hairlines with x/y.
label
string
Default"You"
The arrow's pill. A target's data-cursor-label replaces it.
color
string
Default"var(--primary)"
Arrow fill and the pill dot.
stiffness
number
Default0.28
How quickly it catches up, 0 to 1. 1 follows exactly.
nativeOverInputs
boolean
Defaulttrue
Inputs, selects, text areas and editable text keep the system cursor.
data-cursor-label
attribute
On any element inside: the text shown while over it.
data-cursor="native" | "hidden"
attribute
On any element inside: the system cursor there, always.

The overlay is aria-hidden and never takes pointer events, so clicks, focus and screen readers behave as if it weren't there. It only turns on for a fine pointer (mouse or pen) without reduced motion; otherwise the area renders with no overlay and no cursor changes. Use it on a hero, gallery or canvas, not on a whole app.

What it handles

  1. 01Draws the pointer inside its area as an `arrow` with a name pill, a `dot` that grows into a label, or a `crosshair` with live x and y values.
  2. 02Follows the pointer with a light spring whose `stiffness` runs from 0 to 1, where 1 means no smoothing.
  3. 03Reads `data-cursor-label` on any target under the pointer and swaps the pill or dot text for it.
  4. 04Keeps the system cursor over inputs, text areas, selects and editable text when `nativeOverInputs` is on, and over anything marked `data-cursor` native or hidden.
  5. 05Runs only for a fine pointer, so touch and other coarse pointers get the area untouched.
  6. 06Leaves the area exactly as it was under reduced motion and hides the custom cursor when the pointer leaves.

States

First render
Nothing. The area keeps its native cursor
none
Pointer enters or leaves
The cursor layer fades in and out
120ms, ease out
Pointer moves
The cursor follows with a spring
none
Press
The arrow shrinks slightly
120ms, ease out
Over a labelled target
The dot or pill grows into the label
180ms, ease out
Reduced motion
The custom cursor is off
0ms

Works with

When to use

When to use

  • One showcase area: a hero, a gallery or a canvas where the pointer is part of the moment.
  • Labelling what a click does over large targets, with data-cursor-label (Read, Drag, Open).
  • Showing your own presence in a demo of multiplayer features, next to Agent Cursors.

When not to use

  • A whole app or long forms: people rely on the system cursor for precise work.
  • Other people's or agents' pointers: use Agent Cursors.
  • Hiding what is clickable: links and buttons still need their own hover styles.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Custom Cursor to my app and wire it to my own data.
  • I need one showcase area: a hero, a gallery or a canvas where the pointer is part of the moment. Set that up with the Knowns UI Custom Cursor.
  • Which Custom Cursor props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "custom-cursor" }) and search_docs({ query: "custom cursor" }).

Need help?

Stuck on Custom Cursor, or found something off? We read every message.