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.
More ui design prompts
- CursorAdd Dark Mode with CSS VariablesImplement theme switching with CSS custom properties, localStorage persistence, system preference detection, and flash-free loading.
- CursorAdd WCAG Accessibility to UIWCAG 2.1 AA compliance: keyboard navigation, ARIA labels, focus management, color contrast, and screen reader support.
- v0Analytics DashboardData visualization dashboard with KPI cards, charts, data table, and date range filtering.
- v0Blog LayoutClean blog with featured posts, category filters, reading time, and author profiles.
- CursorBuild Multi-Step Form WizardMulti-step wizard with per-step validation, progress indicator, back/next navigation, and sessionStorage persistence.
- v0Component from DescriptionStructured prompt to generate a polished React component with proper accessibility, responsiveness, and dark mode support.

