Dock
TheDock component creates a macOS-style dock with smooth spring animations and interactive item scaling. Each dock item features dynamic tooltips with rotation and translation effects based on mouse movement.
Installation
Import
Usage
Components
Dock
The container component that wraps all dock items.React.ReactNode
required
The dock items to display.
string
Additional CSS classes for custom styling.
DockItem
Individual items within the dock.React.ReactNode
required
The icon to display in the dock item.
string
required
The label shown in the tooltip on hover.
() => void
Optional click handler function.
string
Additional CSS classes for the dock item.
Animation Details
Dock Container Animation
DockItem Spring Configuration
Hover Effects
- Scale on Hover: Items scale to 1.2x with spring physics
- Tap Scale: Items scale to 0.9x on click
- Rotation: Tooltip rotates ±25° based on mouse position
- Translation: Tooltip shifts ±10px horizontally
Tooltip Animation
The tooltip dynamically rotates and translates based on horizontal mouse movement within each dock item.
Examples
Social Media Dock
App Launcher
Best Practices
- Keep dock items between 4-8 for optimal usability
- Use consistent icon sizes (typically 20-24px)
- Provide clear, concise labels
- Use semantic icon choices that match their function
- Consider adding visual separators for grouped actions
Accessibility
- Fully keyboard accessible
- ARIA labels inherited from icon components
- Supports screen readers
- Respects reduced motion preferences