The living catalog

Hooks & utilities03/04

useDragReorder

G9

ONE reorder behavior for visible lists: HTML5 drag with a private MIME type (card drags never trigger file-drop zones), axis-free drop edges, and the keyboard path (moveBy ±1, bind ⌥↑/⌥↓).

Posture

  • Thunder
  • Door creak
  • Sting
  • Rain bed

Drag to reorder — or the ↑↓ keys, the same code path (G9's a11y law).

npx candlelight-ds add use-drag-reorder

Use when

Reordering rows/cards within one visible list.

Don't use when

Moving items BETWEEN collections (picker/⌘K, per G9) or file-drop zones.

States
draggingdrop target before/after edge
Keyboard
  • ⌥↑/⌥↓moveBy(id, ±1) — the a11y path is the same code path
Acceptance
  • A file drag never reorders; a card drag never opens a drop zone (private MIME).
  • The drop edge follows the axis the two items actually differ on — rail, list, and grid share one hook.

Raw twin: /components/use-drag-reorder.md·Registry item: /r/use-drag-reorder.json