Interaction JS behaviour

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.

  1. Code freeze main is locked for merges Mon
  2. QA pass Regression suite on staging Tue
  3. Release notes Changelog and screenshots Wed
  4. Ship to production Blue-green switch Thu
  5. 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.

  1. Morning in Shiraz 3:12
  2. Caravan 4:48
  3. Rain on the bazaar 2:57
  4. 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.

  1. پاسخ به تیکت‌ها
  2. بازبینی کد
  3. جلسهٔ هفتگی

Space برای برداشتن، جهت‌ها برای جابه‌جایی، دوباره Space برای گذاشتن، Escape برای لغو.

Important props

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="مراحل انتشار" />