Livewire Alert Livewire Alert

Basic Usage

Build alerts fluently — chain setters, end with show().

Hello world

Title + icon + show.

Live demo
SweetAlert2
PHP
LivewireAlert
use Jantinnerezo\LivewireAlert\Facades\LivewireAlert;

public function save()
{
    LivewireAlert::title('Changes saved!')
        ->success()
        ->show();
}

Adding text

Use text() for body copy below the title.

Live demo
SweetAlert2
PHP
LivewireAlert
LivewireAlert::title('Item Saved')
    ->text('The item has been successfully saved to the database.')
    ->success()
    ->show();

Icons

Five built-in icon types.

Live demo
SweetAlert2
PHP
LivewireAlert
LivewireAlert::title('Success')->success()->show();
LivewireAlert::title('Error')->error()->show();
LivewireAlert::title('Warning')->warning()->show();
LivewireAlert::title('Info')->info()->show();
LivewireAlert::title('Question')->question()->show();

Position

Place alerts anywhere on the screen. Pass a Position enum or matching string.

Live demo
SweetAlert2
PHP
LivewireAlert
use Jantinnerezo\LivewireAlert\Enums\Position;

LivewireAlert::title('Question')
    ->position(Position::Center)
    ->question()
    ->show();

// or as string
LivewireAlert::title('Question')
    ->position('center')
    ->question()
    ->show();
Next: Loading alerts