Introducing Motion-Primitives Pro - Advanced components and templates to help you build a website that stands out.

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

Olympic logo Paris 2024

Cursor with custom component

Green herbs

Cursor with image and spring

Christian Church, Eastern Europe

Installation

npx shadcn add "https://motion-primitives.com/c/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.