Draggable Dashboard

A flexible dashboard component with drag-and-drop functionality for rearranging layout items.

Installation

Install the Draggable Dashboard component using your preferred package manager.

npxshadcn@latest addhttps://rigidui.com/registry/draggable-dashboard

Usage

The Draggable Dashboard component provides a grid-based layout system where users can drag and drop items to customize their dashboard arrangement. It includes lock/unlock functionality, flexible grid sizing options, and automatic state persistence using localStorage to maintain layout across sessions.

Live Preview

Dashboard

Drag items to customize your layout

Total Revenue
$45,231.89
+20.1% from last month
Active Users
2,350
+180.1% from last month
Sales
12,234
-19% from last month
Performance
573
+201 since last hour
Revenue Overview
Last 6 months
Jan
Feb
Mar
Apr
May
Jun
Notifications
Recent updates

System Alert

Server maintenance scheduled

New

Update Available

New features released

Info

Discover Its 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.

API Reference

PropTypeDefaultDescription
childrenReactNodeundefinedThe draggable wrapper components to be rendered in the dashboard
classNamestring''Additional class names for styling the dashboard container
showLockTogglebooleantrueWhether to show the lock/unlock toggle switch
showHandlesbooleantrueWhether to show drag handles on items
gridColsnumber3Number of grid columns for the dashboard layout
gapnumber6Gap between grid items (in Tailwind spacing units)
defaultLockedbooleanfalseWhether the dashboard should be locked by default
onOrderChange(newOrder: string[]) => voidundefinedCallback function called when item order changes
persistenceKeystring'draggable-dashboard-order'Unique key for localStorage to persist item order across sessions

DraggableWrapper Props

The DraggableWrapper component wraps individual dashboard items and provides the drag-and-drop functionality.

PropTypeDefaultDescription
id*stringundefinedUnique identifier for the draggable item
childrenReactNodeundefinedThe content to be wrapped and made draggable
gridSize{ cols: number, rows: number }{ cols: 1, rows: 1 }Size of the item in grid columns and rows
classNamestring''Additional class names for styling the wrapper
isLockedbooleanfalseWhether this specific item is locked (inherited from parent)
showHandlebooleantrueWhether to show the drag handle for this item (inherited from parent)

* Required prop