Cursor prompt

Create Drag-and-Drop Interface

Sortable lists and kanban boards with dnd-kit, keyboard accessibility, touch support, and optimistic UI updates.

Build a drag-and-drop {{feature_type}} for {{project_name}} using dnd-kit.

## Items: {{item_description}}

### dnd-kit Setup
Install: @dnd-kit/core @dnd-kit/sortable @dnd-kit/utilities

### Sortable List
```tsx
<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>
  <SortableContext items={itemIds} strategy={verticalListSortingStrategy}>
    {items.map(item => <SortableItem key={item.id} item={item} />)}
  </SortableContext>
  <DragOverlay>{activeItem ? <ItemCard item={activeItem} /> : null}</DragOverlay>
</DndContext>
```

### Kanban Board (cross-column)
- One SortableContext per column with rectSortingStrategy
- closestCorners collision detection for cross-column drops
- Track active container separately to show drop targets

### Sensors
useSensors with PointerSensor (primary) + KeyboardSensor (accessibility).
PointerSensor activationConstraint: { distance: 8 } to allow click vs drag distinction.

### Keyboard Controls
Space to pick up, arrow keys to move, Space to drop, Escape to cancel.
Announce position to screen readers on each move.

### Optimistic Updates + Persistence
1. On drag end: reorder local state immediately using arrayMove
2. PATCH /api/{{entity}}/reorder with { ids: orderedIdArray }
3. On error: revert state, show toast "Failed to save order"

### Output
Configured DndContext, SortableItem component, reorder API route, and kanban board variant.

Fill in: {{feature_type}}, {{project_name}}, {{item_description}}, {{entity}}. In Loopy you fill these in a form and copy the finished prompt in one click.