Core Pattern
Confirm Dialog
Use asConfirm() for decisions that should not auto-dismiss and require a clear user choice.
asConfirm()
The preset applies a question icon, confirm and deny buttons, and disables the timer.
Live demo
SweetAlert2
PHP
LivewireAlert
LivewireAlert::title('Are you sure?')
->text('Do you want to proceed with this action?')
->asConfirm()
->show();
Handling events
Combine asConfirm() with button event handlers to run different server-side logic.
Live demo
SweetAlert2
PHP
LivewireAlert
LivewireAlert::title('Delete Item')
->text('Are you sure you want to delete this item?')
->asConfirm()
->onConfirm('deleteItem', ['id' => $this->itemId])
->onDeny('keepItem', ['id' => $this->itemId])
->show();
public function deleteItem(array $data)
{
$itemId = $data['id'];
}
public function keepItem(array $data)
{
$itemId = $data['id'];
}