Interaction JS behaviour

Swipe actions

A row that slides aside to reveal the actions behind it (start and end sides); a full swipe fires the primary one, and every action is a real button reachable with Tab.

Real scenarios

The component as it is used in a product — not a specimen grid.

An inbox on a phone

Swipe a row toward the end to reveal “Read”, toward the start for “Archive” and “Delete”. Past about 60% of the row the primary action fires on release; a quick flick opens a side even when short. Keyboard: Tab reaches every action (the row opens to show it), Escape closes.

Right to left

The start side is on the right here: swipe left to reveal it.

تماس با تأمین‌کنندهٔ کاغذ
امروز، ساعت ۱۵

Only one side

No start actions: dragging that way only rubber-bands. full-swipe is off, so the end side just opens.

#design-review
12 new messages

Important props

Important props
Prop Type Default What it does
start / end array [] Each side’s actions: id, label, icon, tone, primary and click (a wire:click expression).
fullSwipe float|false 0.62 The fraction of the width past which a swipe fires the primary action; false turns it off.
nx-action (event) string — Every action dispatches its id.

Snippet

<x-nx::swipe-actions
    :start="[['id' => 'read', 'label' => 'خوانده', 'icon' => 'check', 'tone' => 'accent', 'primary' => true, 'click' => 'markRead(4)']]"
    :end="[['id' => 'delete', 'label' => 'حذف', 'icon' => 'trash', 'tone' => 'danger', 'primary' => true, 'click' => 'remove(4)']]">
    …سطر صندوق ورودی…
</x-nx::swipe-actions>