Sortable
A reorderable list, row or grid (layout: vertical, horizontal, grid).
Overview
Give it the items as value (or defaultValue) with onChange, and one SortableItem per item whose id matches getKey(item) (defaults to item.id) — as static children or a render function.
- Pointer: items drag from anywhere; a line marks the drop position.
- `SortableItemHandle`: required on every item — the visible grip and its keyboard / screen-reader drag button. Enter starts, arrows pick the drop position, Enter drops; arrows reach it in a vertical list, Tab in a row or grid.
- `isDisabled`: pins an item in place.
- `selectionMode`: lets several selected items move together.
- `renderDragPreview`: replaces the browser's drag snapshot.
- Events:
onChangealso gets the moved keys and the drop target;onDragStart/onDragEndfollow react-aria.
Installation
CLI
Manual
- 1
Register the @fma-ds namespace in components.json (once)
- 2
Add the item
Files land in
components/fma-ds/sortable.tsx; npm and registry dependencies are installed along with them.
Dependencies
- npm
- cn@^0.5.0lucide-react@^1.61.0react-aria-components@^1.22.1
- Registry
- None