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 DraggableCards
Default Usage
Default Vertical Cards
Fast API Calls
Optimized for speed and efficiency
Beautiful UI
Tailwind + Framer Motion magic
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}> | Sample cards | 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 |
Features
- Smooth Drag Animations: Powered by Framer Motion for fluid drag and drop interactions
- Flexible Layout: Support for both vertical and horizontal arrangements
- Visual Feedback: Cards scale and highlight during drag operations
- Custom Styling: Multiple variants and sizes for different use cases with full className override support
- Responsive Design: Adapts to different screen sizes and touch devices
- Dark Mode Ready: Full support for light and dark themes
- Accessible: Keyboard navigation and screen reader support
- Customizable Styling: Override default styles with className props for container, cards, titles, and descriptions
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"
/>
This component is particularly useful for kanban boards, task prioritization interfaces, playlist managers, and any application where users need to reorder content through an intuitive drag-and-drop interface.