Skip to main content

Cursor

The Cursor component creates an interactive custom cursor that follows the mouse movement within a defined area. It hides the default cursor and displays custom content (text, icons, or React components) that tracks mouse position in real-time.

Installation

Import

Usage

Props

React.ReactNode
required
The content area where the custom cursor will be active.
string | React.ReactNode
required
The custom cursor content. Can be a string for simple text or a React component for complex cursors.
string
Additional CSS classes to apply to the container element.

Interaction Details

Cursor Positioning

The cursor uses precise calculations to track mouse position:

Transform Origin

The cursor is centered on the mouse position using:
The default cursor is automatically hidden when hovering over the component area using cursor: none.

Examples

Call-to-Action Card

Product Showcase

Interactive Text

Use whitespace-nowrap class on the cursor content to prevent text wrapping for multi-word labels.

Use Cases

  • Video players: Show play/pause controls on hover
  • Image galleries: Display zoom or drag indicators
  • Product cards: Indicate clickable areas
  • Interactive presentations: Guide user attention
  • Creative portfolios: Add unique brand interactions

Accessibility

Custom cursors can impact accessibility. Ensure:
  • The cursor content is visible against all backgrounds
  • Touch devices fallback gracefully (no cursor events)
  • Keyboard navigation alternatives are provided