Sortable list
A list reordered by dragging its handles while the others FLIP out of the way; from the keyboard too: Space picks up, arrows move, Space drops, Escape cancels — every step announced.
Real scenarios
The component as it is used in a product — not a specimen grid.
Plan the release
Drag a row by its handle: the others step aside as it passes, a pull past the ends rubber-bands, and the drop springs everything into place. From the keyboard: Tab to a handle, Space, arrows, Space. The new order is reported to the server.
-
Code freeze main is locked for merges Mon
-
QA pass Regression suite on staging Tue
-
Release notes Changelog and screenshots Wed
-
Ship to production Blue-green switch Thu
-
Announce Email and social Thu
Press Space to pick up, the arrow keys to move, Space again to drop, Escape to cancel.
A playlist, in the browser
No server here: the nx-sort event hands Alpine the ids in their new order.
-
Morning in Shiraz 3:12
-
Caravan 4:48
-
Rain on the bazaar 2:57
-
Night train 5:05
Press Space to pick up, the arrow keys to move, Space again to drop, Escape to cancel.
Right to left
Persian announcements with Persian position numbers; the handle sits at the inline start.
-
پاسخ به تیکتها
-
بازبینی کد
-
جلسهٔ هفتگی
Space برای برداشتن، جهتها برای جابهجایی، دوباره Space برای گذاشتن، Escape برای لغو.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| items | array | [] | The rows: id, label and optionally description, meta, icon. |
| action | string | null | A Livewire method that receives the new order of ids; nx-sort fires too. |
| messages | array | English | The announcements: grabbed, moved, dropped, cancelled with {name}, {position}, {total}. |
| handleLabel / instructions | string | 'Reorder {name}' | The handle’s name and the keyboard instructions read with it. |
Snippet
<x-nx::sortable-list :items="$steps" action="reorder" label="مراحل انتشار" />