Cursor

A custom cursor component with optional spring animations. It can be globally applied to the page or attached specifically to a parent element.

Examples

Cursor with image and spring

Riverside marketPoster series, 2025

Cursor with custom component

Herb garden

Cursor with image and spring

Lighthouse at Vell Point

Installation

npx shadcn@latest add https://ui.ndekocode.dev/r/motion-cursor.json

Component API

PropTypeDefaultDescription
childrenReactNoderequiredChildren to be rendered within the custom cursor. Mandatory.
classNamestringOptional CSS class for styling the custom cursor container.
springConfigSpringOptionsConfiguration for the spring physics used in the cursor's movement.
attachToParentbooleanfalseIf true, the cursor will only be visible when hovering over its parent component.
transitionTransitionTransition settings from motion for animation effects.
variantsObject (with initial, animated, exit properties)Variants for controlling the animation states with specific properties for initial, animate, and exit states.
onPositionChange(position: { x: number, y: number }) => voidCallback function that is called when the cursor position changes.