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
- Agent cursor demos
- Gallery hover labels
- Canvas tools
- Product showcases
Examples
Opting out
Installation
npx knowns-ui@latest add custom-cursorPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Custom Cursor from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/custom-cursor
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add custom-cursor
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- components/ui/knowns/custom-cursor.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/custom-cursor, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "custom-cursor" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.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- Default
0.28 - How quickly it catches up, 0 to 1. 1 follows exactly.
- nativeOverInputs
boolean- Default
true - 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.
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "arrow" | "dot" | "crosshair" | "arrow" | Arrow with a name pill, a dot that becomes a label, or hairlines with x/y. |
| label | string | "You" | The arrow's pill. A target's data-cursor-label replaces it. |
| color | string | "var(--primary)" | Arrow fill and the pill dot. |
| stiffness | number | 0.28 | How quickly it catches up, 0 to 1. 1 follows exactly. |
| nativeOverInputs | boolean | true | 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
- 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.
- 02Follows the pointer with a light spring whose `stiffness` runs from 0 to 1, where 1 means no smoothing.
- 03Reads `data-cursor-label` on any target under the pointer and swaps the pill or dot text for it.
- 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.
- 05Runs only for a fine pointer, so touch and other coarse pointers get the area untouched.
- 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
| State | What moves | Timing |
|---|---|---|
| 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" }).