Sortable

The foundational drag-and-drop reorder primitive — a zero-dependency, accessible engine that makes any collection reorderable: a single vertical/horizontal list, a wrapping 2D grid, or a Kanban board (cross-container). Keyboard drag mode and screen-reader announcements come for free; edge auto-scroll, a touch long-press sensor, a drop indicator, and multi-item drag are built in. A `useSortable` hook wires the same engine into List, Tree, and Table.

Stablev0.3.0@garn/ui/sortable

Default

A single vertical list — whole-item drag, keyboard-operable, with the shared instructions node.

Research
Design
Build
Ship

Handle

A list with a grip handle + interactive row content (badge, menu button) — only the handle drags, so the button stays clickable.

Inbox12
Drafts3
Sent84
Archive210

Horizontal

Horizontal reorder — a row of chips, ←/→ keyboard.

To do
In progress
Review
Done

Board

A Kanban board — Sortable.Group of columns + a Sortable.Overlay; cards move between columns.

Todo
Audit tokens
Fix a11y bug
In progress
Write docs
Review PR
Done
Ship v1

Multi Item

Multi-item drag — click to select, then drag one selected item to move the whole set (count badge).

Alpha
Bravo
Charlie
Delta
Echo

2 selected · drag one to move all

Grid

A wrapping 2D grid (orientation=grid) — closest-center projection, spatial ←/→ ↑/↓ keyboard, drop indicator.

1
2
3
4
5
6
7
8
9

Drop Indicator

The built-in insertion line (dropIndicator) + onDragOver reporting the live target slot.

Overview
Analytics
Reports
Settings

Drag a page to reorder

Scrollable

A tall list in a fixed-height scroll container — edge auto-scroll drags past the fold; long-press on touch.

Task 1
Task 2
Task 3
Task 4
Task 5
Task 6
Task 7
Task 8
Task 9
Task 10
Task 11
Task 12
Task 13
Task 14
Task 15
Task 16
Task 17
Task 18

Headless

The useSortable hook wired onto a consumer's own <ul>/<li> markup (the List/Tree integration pattern).

  • Overview
  • Members
  • Billing
  • Security