Swipe a card sideways to show buttons behind it, like in a mail app. The buttons are the table’s own row actions, chosen by name: their labels, colours, confirmations and permissions stay the same.
1Swipe part of the way
The buttons stay open until you tap one or tap somewhere else.
Try it
- In “Deliveries”, press the mouse button on the card of Olivia Bennett, drag about a third of the way to the left and let go.
- “Not home” and “Edit” are now open on the right of the card (“Edit”, at the edge, is the first one).
- Tap the title “Today’s deliveries” to close them.
What happens
The card slides back. Swiping another card also closes the open one.
The code
$table
->recordActions([
ActionGroup::make([
Action::make('delivered')->requiresConfirmation()->...,
Action::make('notHome')->requiresConfirmation()->...,
EditAction::make(),
]),
])
// The names of the row actions, for each side
->swipeActions(leading: 'delivered', trailing: ['edit', 'notHome'])
2Swipe all the way
Swiping past the middle runs the first button of that side.
Try it
- Press the mouse button on the card of Noah Fischer and drag all the way to the left edge of the phone, then let go.
What happens
The first button on that side (“Edit”, at the edge) runs: the delivery of Noah Fischer opens. fullSwipe: false turns this off.
The code
// On by default. To turn it off:
->swipeActions(leading: 'delivered', trailing: ['edit', 'notHome'], fullSwipe: false)
3A button that asks first
A button with requiresConfirmation() asks before it runs, as in the ⋮ menu.
Try it
- Drag the card of Marcus Reed a little to the right and let go.
- Tap the green “Mark as delivered” button that appeared on the left.
- Tap “Confirm” in the sheet that opens from the bottom.
What happens
The status of Marcus Reed changes to “Delivered”.
The code
Action::make('delivered')
->requiresConfirmation()
->action(fn (Delivery $record) => $record->update(['status' => 'delivered']))
Click to tap. To swipe or pull, press the mouse button and drag — the mouse works like a finger here.
You are on a phone
The phone frame is for computers. On your phone, open the app itself and follow the steps with your finger.
Open the app