Overview
TheCursors component displays the real-time mouse cursors of all connected users on the page. It provides smooth cursor tracking with customizable colors, animations, and user information display. This component is perfect for collaborative applications where visual awareness of other usersโ activity is important.
Perfect for: Collaborative design tools, document editors, drawing applications, presentations, and any interface where cursor awareness enhances collaboration.
Basic Usage
Props
TheCursors component accepts all props from both useCursors options and cursor appearance options:
Cursor Tracking Options
boolean
default:"false"
Whether to hide your own cursor from the display
boolean
default:"true"
Whether to remove cursors when users leave the session
number
default:"16"
Milliseconds to throttle cursor position updates (16ms = ~60fps)
Cursor Appearance Options
number
default:"100"
Duration in milliseconds for cursor movement animations
(userId: string) => string
Function to determine cursor color for each user
CursorsComponents
Custom components to override cursor display
CursorsComponents Interface
Examples
Basic Cursor Display
Simple cursor tracking with default settings:Custom Cursor Colors
Implement custom color assignment for different users:High-Performance Cursors
Optimized settings for applications with many users:Custom Cursor Component
Create a custom cursor with user information display:Drawing Application with Cursors
Integrate cursors into a collaborative drawing application:Presentation Mode with Cursors
Use cursors for interactive presentations:Gaming Interface with Cursors
Implement cursors in a collaborative gaming interface:Hide Own Cursor
Display only other usersโ cursors:Performance Considerations
Throttling
AdjustthrottleDelay based on your needs:
Animation Performance
Control animation smoothness:Styling
The Cursors component uses these default styles:Best Practices
Performance
User Experience
Mobile Considerations
Common Patterns
- Design Tools: High-frequency updates for precise collaboration
- Document Editing: Medium-frequency updates with user identification
- Gaming: Color-coded cursors representing players
- Presentations: Smooth cursor animations for pointing
- Drawing Apps: Ultra-responsive cursor tracking
Related Hooks
useCursors- The underlying hook powering the Cursors componentuseConnectedUsers- Get user information for cursor displayuseMyId- Identify your own cursor