Interactive
Animated Cursor
Advanced animated cursor component with customizable following elements and spring animations. Perfect for React applications requiring interactive cursor effects with Next.js integration and TypeScript support.
Powered by
Installation
npx shadcn@latest add https://www.shadcn.io/registry/animated-cursor.json
npx shadcn@latest add https://www.shadcn.io/registry/animated-cursor.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/animated-cursor.json
bunx shadcn@latest add https://www.shadcn.io/registry/animated-cursor.json
Features
- Custom cursor replacement with animated scale and opacity transitions
- Following elements with spring-based physics and configurable alignment options
- Context-based architecture using React Context for state management across components
- Automatic parent positioning with intelligent relative positioning detection
- Spring animations with customizable stiffness, damping, and bounce parameters
- TypeScript support with complete interface definitions and alignment types
- shadcn/ui integration using design system utilities and responsive classes
Examples
Cursor Follow Only
Use Cases
This free open source React component works well for:
- Creative portfolios - Artistic cursor interactions built with Next.js
- Interactive presentations - Engaging cursor effects using TypeScript and Tailwind CSS
- Design showcases - Portfolio cursor customization with shadcn/ui integration
- Gaming interfaces - Custom cursor mechanics for React applications
- Marketing pages - Eye-catching cursor animations with spring physics
API Reference
CursorProvider
Prop | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | required | Child components that use cursor context |
className | string | - | Additional CSS classes for provider container |
Cursor
Prop | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | required | Custom cursor content (SVG, icon, etc.) |
className | string | - | Additional CSS classes for cursor element |
CursorFollow
Prop | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | required | Following element content (tooltip, badge, etc.) |
sideOffset | number | 15 | Distance offset from cursor in pixels |
align | Align | 'bottom-right' | Positioning relative to cursor |
transition | SpringOptions | { stiffness: 500, damping: 50, bounce: 0 } | Spring animation configuration |
className | string | - | Additional CSS classes for follow element |
Alignment Options
- center - Centered on cursor position
- top - Above cursor with center alignment
- top-left - Above and to the left of cursor
- top-right - Above and to the right of cursor
- bottom - Below cursor with center alignment
- bottom-left - Below and to the left of cursor
- bottom-right - Below and to the right of cursor (default)
- left - To the left with center alignment
- right - To the right with center alignment
Spring Configuration
transition?: {
stiffness?: number; // Spring stiffness (default: 500)
damping?: number; // Spring damping (default: 50)
bounce?: number; // Spring bounce (default: 0)
mass?: number; // Spring mass
velocity?: number; // Initial velocity
}
Implementation Notes
- Automatically sets parent element position to relative if static
- Hides default cursor when component is active using CSS cursor: none
- Uses React Context for efficient state sharing between cursor elements
- Calculates positioning based on mouse coordinates relative to parent container
- Spring animations provide smooth, natural following motion with motion/react
- Elements are positioned with high z-index values for proper layering
- Supports nested components and complex cursor interactions
- Integrates seamlessly with shadcn/ui design system and accessibility patterns
Image Zoom
Click-to-zoom image component for React and Next.js applications. Built with TypeScript support, Tailwind CSS styling, and shadcn/ui design featuring smooth transitions, backdrop blur, and mobile-friendly interactions.
Apple Hello Effect
Handwriting animation component for React and Next.js applications. Built with Motion, TypeScript support, and Tailwind CSS styling featuring Apple-inspired text animations with multilingual support and customizable timing.