- 1. Design reviewMichaelToday
- 2. Ship pricing pageRileyTomorrow
- 3. Write release notesJaydenFriday
- 4. Plan next sprintMichaelNext week
Drag the handles, or focus one and press Alt + ↑/↓.
Installation
$ pnpm dlx shadcn@latest add @synccn/sortable-listFirst time in this project? Connect synccn with one command.
Usage
import { SortableList } from "@/components/ui/sortable-list";<SortableList items={items} onChange={setItems} renderItem={(it) => …} />API reference
Generated from the component's TypeScript types, so it always matches the code.
SortableList
Drag to reorder (mouse or touch), or focus a handle and use Alt+Up / Alt+Down. items: [{ id, ... }]; renderItem(item) returns the row content.
PropTypeDescription
- items
T[]Controlled items.
- defaultItems
T[]Initial items when uncontrolled.
- onChange
(items: T[]) => voidCalled with the new order.
- renderItemrequired
(item: T, index: number) => React.ReactNodeRenders a row's content.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for GripVertical
Keyboard
- ↑or↓Move the focused item up or down
Accessibility
- Every move is announced through a live region, so screen reader users hear the new position.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA attributes: aria-label, aria-live
- Keys handled: ArrowUp, ArrowDown
- Includes text only screen readers hear
- Announces changes to screen readers
More data
Data TableSorting, search, column visibility, selection and paging.Bar ChartResponsive SVG bars with tooltips and an entrance.Area ChartSmooth area with a crosshair tooltip.SparklineTiny trend line coloured by direction.HeatmapContribution-style calendar of daily counts.KanbanDrag cards between columns.