Skip to Content
✨ Just dropped my UI Library — still cooking up some magic! Stay tuned & maybe… hire me  or sponsor me 😉 
DocumentationDraggable Cards

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

PropTypeDefaultDescription
cardsArray<{id: number, title: string, description: string}>Sample cardsArray of card objects to display and make draggable
horizontalbooleanfalseWhether 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[]) => voidundefinedCallback function called when cards are reordered
classNamestringundefinedCustom classes for the main container
cardClassNamestringundefinedCustom classes for individual cards
titleClassNamestringundefinedCustom classes for card titles
descriptionClassNamestringundefinedCustom classes for card descriptions
dragScalenumber1.02Scale factor applied to cards when being dragged
dragBoxShadowstringundefinedCustom box shadow for cards when being dragged
normalBoxShadowstringundefinedCustom box shadow for cards in normal state
dragBackgroundstringundefinedCustom background color/gradient for cards when dragging
normalBackgroundstringundefinedCustom 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.

Last updated on