Draggable Dashboard
A flexible dashboard component with drag-and-drop functionality for rearranging layout items.
Usage
Dashboard
Drag items to customize your layout
import DraggableDashboard, { DraggableWrapper } from "@/components/draggable-dashboard"
export default function MyDashboard() {
return (
<div className="w-full max-w-4xl mx-auto">
<DraggableDashboard
showLockToggle={true}
showHandles={true}
gridCols={3}
gap={4}
defaultLocked={false}
persistenceKey="my-dashboard"
>
<DraggableWrapper id="revenue" gridSize={{ cols: 1, rows: 1 }}>
<RevenueCard />
</DraggableWrapper>
<DraggableWrapper id="users" gridSize={{ cols: 1, rows: 1 }}>
<UsersCard />
</DraggableWrapper>
<DraggableWrapper id="sales" gridSize={{ cols: 1, rows: 1 }}>
<SalesCard />
</DraggableWrapper>
<DraggableWrapper id="performance" gridSize={{ cols: 1, rows: 1 }}>
<PerformanceCard />
</DraggableWrapper>
<DraggableWrapper id="chart" gridSize={{ cols: 2, rows: 1 }}>
<SimpleChart />
</DraggableWrapper>
</DraggableDashboard>
</div>
)
}
Installation
Install the Draggable Dashboard component using your preferred package manager.
npx shadcn@latest add https://rigidui.com/r/draggable-dashboard.json
Features
The Draggable Dashboard component is packed with powerful features designed to provide an exceptional user experience.
Drag & Drop
Intuitive drag and drop interface allows users to reorder dashboard components easily.
Grid Layout
Responsive grid system with customizable columns and flexible item sizing.
Lock/Unlock
Toggle between edit and view modes to prevent accidental changes to the layout.
Flexible Sizing
Components can span multiple columns and rows to create complex dashboard layouts.
State Persistence
Dashboard layout is automatically saved to localStorage and persists across page reloads and browser sessions.
Props
DraggableDashboard
Prop | Type | Default |
---|---|---|
children | ReactNode | undefined |
className? | string | '' |
showLockToggle? | boolean | true |
showHandles? | boolean | true |
gridCols? | number | 3 |
gap? | number | 6 |
defaultLocked? | boolean | false |
onOrderChange? | (newOrder: string[]) => void | undefined |
persistenceKey? | string | 'draggable-dashboard-order' |
DraggableWrapper
Prop | Type | Default |
---|---|---|
id | string | undefined |
children | ReactNode | undefined |
gridSize? | { cols: number, rows: number } | { cols: 1, rows: 1 } |
className? | string | '' |
isLocked? | boolean | false |
showHandle? | boolean | true |
Currency Manager
A flexible set of components for managing currency display and selection. Users provide exchange rates relative to a fixed base currency, and the component handles fetching currency names and performing conversions.
File Explorer
A flexible grid/list component that provides seamless switching between grid and list layouts with customizable card rendering.