The Draggable Canvas component provides a smooth, physics-based draggable interface with momentum, elastic boundaries, and support for any content type. Perfect for creating interactive galleries, mood boards, or creative portfolios.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fgrreloaded/rigidui/llms.txt
Use this file to discover all available pages before exploring further.
Installation
Usage
- Preview
- Code
An interactive canvas that can be dragged with smooth physics-based momentum.
API Reference
DraggableCanvas
Array of items to display on the canvas
Canvas width (CSS units or number for pixels)
Canvas height (CSS units or number for pixels)
Whether to show visual boundary indicators
Whether to show corner labels (TL, TR, BL, BR)
Additional CSS classes for the canvas
Inline styles for the canvas
Momentum decay rate (0-1, higher = less friction)
Boundary bounce effect strength (0-1)
Velocity reduction on boundary collision (0-1)
Minimum velocity before stopping animation
Whether to center canvas initially when larger than viewport
DraggableCanvasItem
Image source URL (when using image content)
Vertical position from canvas top (CSS units)
Horizontal position from canvas left (CSS units)
Item width (CSS units or number for pixels)
Item height (CSS units or number for pixels)
Custom React content (overrides src)
Scale factor on hover (1 = no scale)
Examples
Basic Image Gallery
Custom Content Items
High-Performance Setup
Optimize physics parameters for smoother performance:Development Mode with Boundaries
Enable visual boundaries to see the canvas edges:Physics Parameters
The Draggable Canvas uses realistic physics simulation:Friction - Controls how quickly momentum decays (0.9 = more momentum, 0.8 = less momentum)
Elasticity - How much items bounce when hitting boundaries (0 = no bounce, 0.5 = strong bounce)
Rebound Damping - Velocity reduction on boundary collision (0.5 = loses half velocity, 1 = no reduction)
Features
Smooth Physics - Built-in momentum, friction, and elastic boundary rebounds create a natural, fluid dragging experience with customizable physics parameters.
Performance Optimized - Uses requestAnimationFrame for smooth 60fps animations and transform3d for hardware acceleration on both desktop and mobile.
Flexible Content - Supports images, custom React components, or any content with individual positioning, sizing, and hover effects.
Accessibility
The Draggable Canvas is designed with accessibility in mind:- Supports both mouse and touch interactions
- Maintains focus states during dragging
- Respects user’s motion preferences
- Works with screen readers for static content