drag-and-drop

Implement drag-and-drop interactions for sortable lists and kanban boards.

2|2|Updated May 30, 2025
One-click install
npx skills add https://github.com/wodsmith/thewodapp --skill drag-and-drop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drag-and-drop
Source: https://github.com/wodsmith/thewodapp/tree/main/.claude/skills/drag-and-drop
Command: npx skills add https://github.com/wodsmith/thewodapp --skill drag-and-drop

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a practical pattern for building drag-and-drop interactions using Atlassit's pragmatic-drag-and-drop library. It covers draggable setup, drop targets, edge detection, drag previews, and volatile state patterns to avoid performance issues.

Core Features & Use Cases

  • Draggable Setup: Setup draggable handles and initial data.
  • Drop Targets: Define drop zones and data.
  • Edge Detection & Preview: Determine drop edge and render previews.
  • Volatile State Pattern: Use refs to manage volatile drag state to avoid re-registers; ensure useCallback for dependencies.
  • Performance Guidance: Avoid unnecessary re-renders.
  • Use Case: Kanban board reordering, sortable lists.

Quick Start

Follow the Basic Draggable Item Pattern:

  • Import necessary APIs from @atlaskit/pragmatic-drag-and-drop
  • Create DraggableItem component with refs for the item and drag handle
  • Bind draggable with dropTargetForElements and manage item data
  • Implement onGenerateDragPreview to render a custom drag preview
  • Use a ref-based pattern to track closest edge and render indicators

Frequently Asked Questions about drag-and-drop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement drag-and-drop for sortable lists and kanban boards?

Drag-and-drop interactions use @atlaskit/pragmatic-drag-and-drop to bind draggable elements, define drop targets, detect edges, and render previews. Set up draggable items with refs, bind drop targets with data, implement onGenerateDragPreview for custom previews, and use ref-based volatile state to track the closest edge for reordering without performance issues.

What's the best way to avoid re-rendering issues when building drag-and-drop UI?

Use a volatile state pattern with refs to manage drag state instead of component state, ensuring handlers don't re-register. Wrap handler functions in useCallback with stable dependencies to prevent unnecessary re-renders and maintain consistent drag performance across interactions.

How do I detect where an item should drop in a drag-and-drop interaction?

Edge detection determines the drop position by calculating the closest edge relative to the drop target. Pragmatic-drag-and-drop provides mechanisms to track edge proximity and render visual indicators—like insertion lines—to show users exactly where items will reorder before they release.

Can I customize the appearance of dragged items during drag-and-drop?

Yes, implement onGenerateDragPreview to render a custom drag preview that displays as users drag. This lets you show a styled copy of the item, icon, or custom visual feedback, improving user experience and clarity about what's being moved.

Do I need special setup to make elements draggable with pragmatic-drag-and-drop?

Draggable setup requires importing APIs from @atlaskit/pragmatic-drag-and-drop, creating refs for the item and drag handle, binding with dropTargetForElements, and attaching item data. This prepares elements for drag interactions and connects them to drop zones.

What performance patterns should I follow when building reorderable UI?

Avoid unnecessary re-renders by using refs for volatile drag state and useCallback for stable handler callbacks. Keep state updates minimal during drag operations and ensure drop target bindings remain consistent to maintain responsive interactions on complex lists and kanban boards.