Draggable Cards
An interactive card component that allows users to reorder items through drag and drop. Perfect for task management, prioritization interfaces, and customizable dashboards.
Install Dependencies
npx quickcode-ui add DraggableCardsDefault Usage
Default Vertical Cards
Project Alpha
High-priority development task with tight deadline
Design Review
UI/UX review session for the new dashboard
Code Review
Review pull requests from the development team
Team Meeting
Weekly sync with the entire development team
Horizontal Layout
Horizontal Draggable Cards
Project Alpha
High-priority development task with tight deadline
Design Review
UI/UX review session for the new dashboard
Code Review
Review pull requests from the development team
Team Meeting
Weekly sync with the entire development team
Bordered Variant
Bordered Variant
Marketing Campaign
Launch the new product marketing campaign across all channels
Customer Support
Respond to customer inquiries and resolve pending tickets
Data Analysis
Analyze user behavior data from the past quarter
Large Size with Custom Handler
Large Size with Custom Handler
System Architecture
Design and implement scalable system architecture for the new platform
Database Optimization
Optimize database queries and improve overall performance metrics
Props
| Prop | Type | Default | Description |
|---|---|---|---|
cards | Array<{id: number, title: string, description: string}> | [] | Array of card objects to display and make draggable |
horizontal | boolean | false | Whether to arrange cards horizontally instead of vertically |
variant | "default" | "bordered" | "filled" | "default" | Visual style variant of the cards |
size | "sm" | "md" | "lg" | "md" | Size variant affecting padding and text size |
onReorder | (newCards: Card[]) => void | undefined | Callback function called when cards are reordered |
className | string | undefined | Custom classes for the main container |
cardClassName | string | undefined | Custom classes for individual cards |
titleClassName | string | undefined | Custom classes for card titles |
descriptionClassName | string | undefined | Custom classes for card descriptions |
dragScale | number | 1.02 | Scale factor applied to cards when being dragged |
dragBoxShadow | string | undefined | Custom box shadow for cards when being dragged |
normalBoxShadow | string | undefined | Custom box shadow for cards in normal state |
dragBackground | string | undefined | Custom background color/gradient for cards when dragging |
normalBackground | string | undefined | Custom background color/gradient for cards in normal state |
Styling Examples
// Custom container styling
<DraggableCards
className="max-w-3xl bg-gray-50 dark:bg-gray-900 p-4 rounded-lg"
/>
// Custom card styling with proper dark mode
<DraggableCards
cardClassName="bg-gradient-to-r from-blue-500 to-purple-600 dark:from-blue-600 dark:to-purple-700 text-white border-none"
titleClassName="text-yellow-300 dark:text-yellow-200"
descriptionClassName="text-blue-100 dark:text-blue-200"
/>