v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS
SortableList
Reorder items with drag or explicit move buttons.
Interactive preview
- Design the interface
- Build the components
- Review and ship
Usage
import { SortableList } from "@devvy-ui/react";
<SortableList label="Project order" items={items} onItemsChange={setItems} />API reference
Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:
| Prop | Type | Default | Description |
|---|---|---|---|
| items | SortableItem[] | required | Stable ids, readable labels and optional content/disabled. |
| onItemsChange | (items: SortableItem[]) => void | required | Controlled order callback. |
| disabled | boolean | false | Disable reordering. |
Accessibility & behavior
Platform Behavior & Guidelines
Native HTML drag accepts only this list's own payload. Move up/down buttons provide keyboard and touch alternatives and preserve keyed focus. Live status reports the new position.
Source ownership
Run npx @devvy-ui/cli init once in your React project, then add the source:
npx @devvy-ui/cli add sortable-listMake the source yours.
Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.
SortableList.tsxREACT / TSX
Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.