Core Pattern
Buttons
Add confirm, cancel, and deny buttons when an alert needs an explicit decision.
Button types
Enable the buttons you need with withConfirmButton(), withCancelButton(), and withDenyButton().
Live demo
SweetAlert2
PHP
LivewireAlert
LivewireAlert::title('Save?')
->withConfirmButton('Yes, Save')
->show();
LivewireAlert::title('Hey cancel')
->withCancelButton('Cancel')
->show();
LivewireAlert::title('Do you want to do it?')
->withDenyButton('No')
->show();
Button text
Enable each button first, then override the text with the matching text method.
Live demo
SweetAlert2
PHP
LivewireAlert
LivewireAlert::title('Save?')
->withConfirmButton()
->confirmButtonText('Save')
->withDenyButton()
->denyButtonText('Discard')
->withCancelButton()
->cancelButtonText('Cancel')
->show();
Button colors
Use CSS color names, hex values, or other CSS-compatible colors.
Live demo
SweetAlert2
PHP
LivewireAlert
LivewireAlert::title('Choose an action')
->question()
->withConfirmButton('Save')
->withDenyButton('Delete')
->withCancelButton('Cancel')
->confirmButtonColor('#16a34a')
->denyButtonColor('#dc2626')
->cancelButtonColor('#64748b')
->show();