Quick Example
Drag & Drop Usage
Start with SortableList for list reordering, or useDragDrop for kanban-style moves between zones.
Code
<script lang="ts">
import { SortableList, useDragDrop } from 'svelora';
// Reorder within one list
let tasks = $state([
{ id: 'a', title: 'Design tokens' },
{ id: 'b', title: 'Ship release' }
]);
// Move between drop zones
let zone = $state<'a' | 'b' | null>(null);
const dragDrop = useDragDrop();
</script>
<!-- Sortable list -->
<SortableList bind:items={tasks} getKey={(task) => task.id}>
{#snippet children({ item })}
<span>{item.title}</span>
{/snippet}
</SortableList>
<!-- Cross-container drag -->
<dragDrop.Provider>
<div use:dragDrop.droppable={{ id: 'a', onDrop: () => (zone = 'a') }}>Zone A</div>
<div use:dragDrop.droppable={{ id: 'b', onDrop: () => (zone = 'b') }}>Zone B</div>
{#if zone === 'a' || zone == null}
<div use:dragDrop.draggable={{ id: 'card', container: zone ?? 'a', data: 'Drag me' }}>
Drag me
</div>
{/if}
</dragDrop.Provider>
Drag & Drop
Interactive guide and playground for sortable lists and cross-container drag, powered by @dnd-kit/svelte.
Built with useSortable, useDragDrop, and SortableList.
Advanced demos below also mirror the dnd-kit-svelte examples (basic, sortable columns, nested containers), adapted for official @dnd-kit/svelte.
Jump to demo
Basic
Drag between three zones (A/B/C)
Task columns
In progress / done with live drag-over
Nested containers
Reorder groups and move tasks
Sortable list
Vertical reorder
Horizontal
Horizontal axis
Grid
2D CSS grid sort
Drag handle
Handle-only dragging
Whole row
Drag the entire row
Disabled
Toggle sorting off
Interactive
Inputs inside rows
Multiple lists
Independent sortable groups
Kanban (2 col)
Move cards between columns
Kanban (3 col)
Todo / progress / done
Conditional
accept filter on drop
Rich content
Badges and metadata
Manual markup
useSortable directly
When to use what
SortableList
Fastest path for vertical, horizontal, or grid lists with bind:items.
Basic
Cross-container drag with three drop zones — ported from the dnd-kit-svelte basic example via useDragDrop.
Task columns
Two-column task board with live column switching on drag-over and reorder on drop — from the sortable example using @dnd-kit/svelte directly.
In Progress
Done
Nested containers
Sortable task groups with nested items that can move between containers — from the nested example.
Development Tasks
Technical implementation tasks
Setup Project
Initialize repository and configure tools
Create Components
Build reusable UI components
Design Tasks
UI/UX design related tasks
Color Palette
Define brand colors and variants
Typography
Select and implement fonts
Drag containers to reorder groups, or move tasks between them.
Sortable list
Horizontal
Grid
CSS Grid layout — dnd-kit detects 2D flow automatically when axis is grid.
Drag handle
Whole row drag
Disabled
Interactive elements
Drag from the grip only — inputs and buttons stay interactive (built into @dnd-kit).
Multiple lists
Backlog
This sprint
Kanban (2 columns)
todo
done
Kanban (3 columns)
todo
In progress
done
Conditional drop
Archive rejects items whose label contains draft (case-insensitive).
Inbox
Archive
accept — blocks "draft" files
Rich content
Manual markup
Related docs
Hook API and manual markup.
Cross-container kanban patterns.
Styled component with bind:items.