Skip to content

Sortable

Allows users to reorder items in a list or grid by dragging and dropping them with smooth layout animations.

11.3 KB
•
Updated on August 21, 2026

Installation

Bash

Usage

Code
Code

Examples

Grid

Nested

Persist to a backend

Persisting order

Sortable commits once, on drop, so onValueChange alone is already enough to persist the whole array. When you want index-based mutations and a one-line rollback, use onValueCommit: it fires with the reordered array and a previousValue snapshot.

Code

API Reference

Sortable

The root component that manages the sortable state and drag-and-drop context.

SortableCommitMeta<T> is { event: DragEndEvent; activeIndex: number; overIndex: number; previousValue: T[] }.


SortableItem

An individual draggable item within the sortable list.


SortableItemHandle

The drag handle for an individual sortable item.

All 8 variations

Sortable playlist with frame

Sortable settings priority with frame

Sortable sidebar navigation with frame

Keep in mind

  • MIT License: Free and open-source for personal and commercial use. Feel free to copy, tweak, and adapt the components to match your exact needs.
  • Credits & Inspiration: Some components on this site are inspired by or recreated from great ideas across the web. I'm not here to take credit; just to learn, experiment, and push interface craft further.
  • Reach out & Claims: If an attribution was missed, or if you have any inquiry or claim, feel free to reach out directly on X to @adrielzimbril. I'll be glad to update or resolve it right away.