Sortable List

Drag-to-reorder list where only the grip handle lifts a row, the lifted row rises with a soft shadow and slight scale while its siblings spring out of the way, and a full keyboard path (Space to pick up, arrows to move, Space to drop, Escape to restore) announces every move to screen readers. Generic over any item with an id, controlled/uncontrolled, reduced-motion safe.

Preview

Sortable List preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/sortable-list
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

items?
T[]

Controlled order.

—
defaultItems?
T[]

Initial order when uncontrolled.

—
onChange?
((items: T[]) => void)

Fires once per completed move (pointer release or keyboard drop).

—
renderItem
(item: T, state: SortableItemState) => ReactNode
—
getLabel?
((item: T) => string)

Human-readable name used for the handle label and announcements.

(item) => String(item.id)
className?
string
—
itemClassName?
string
—

Updated