Ballmac UI home

Smooth Cursor

A custom cursor for one area that glides after the pointer on a spring, leans into the direction of travel, shrinks on press and grows a label over elements marked with data-cursor-label.

Move around. Hover a tile to see its label.

Installation

$ pnpm dlx shadcn@latest add @ballmac/smooth-cursor

Usage

import { SmoothCursor } from "@/components/ballmac/smooth-cursor"

The full example is in the Code tab above.

Examples

Custom cursor graphic

A floaty ring instead of an arrow.

API reference

PropTypeDefault
children*

The area the custom cursor lives in. Outside it, the normal cursor returns.

React.ReactNode—
cursor

Your own cursor graphic. The default is an arrow that leans into the direction you are moving.

React.ReactNode—
hideNative

Hide the system cursor inside the area. Text fields always keep theirs.

booleantrue
stiffness

Stiffness of the follow spring. Lower is floatier.

number420

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
KeyboardUnaffected: focus rings and tab order do not change
Screen readersThe cursor is aria-hidden
Reduced motionThe cursor follows the pointer with no spring or lean

Use with AI

<SmoothCursor cursor hideNative stiffness>area</SmoothCursor>. It only covers its own area, ignores touch, leaves text fields on the normal cursor and sets no global styles. data-cursor-label='View' on any child adds a label. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Smooth Cursor (@ballmac/smooth-cursor) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Portfolios and galleries
  • Product tours with hover storytelling

Not for

  • Form-heavy or data-dense screens
  • Touch-first products

Registry JSON: https://ui.ballmac.com/r/smooth-cursor.json

Credits

Free to use in personal and commercial projects.

Registry
shadcn/utils