A Laravel Livewire package that brings beautiful toast notifications to your Livewire applications. Inspired by the elegant UI of Sileo and built with the Livewire notification patterns pioneered by Livewire Alert.
Install the package and frontend dependencies:
composer require mrclln/wire-sileo
npm install sileo lucide-react react react-dom
The package requires:
sileo - The React toast component (v0.1.5+)lucide-react - Icon library for custom iconsreact and react-dom - Required by SileoPublish the configuration, JavaScript bridge, and view:
php artisan vendor:publish --tag=wire-sileo
This publishes:
config/wire-sileo.php - Configuration fileresources/js/wire-sileo.js - JavaScript bridgeresources/views/wire-sileo.blade.php - Blade view componentAdd the Livewire toaster to your application layout:
<livewire:wire-sileo />
Import the published bridge in your Vite entrypoint, or add it to vite.config.js:
Option 1: Import in your app entrypoint (e.g., resources/js/app.js):
import './wire-sileo.js';
Option 2: Add as a separate Vite input (in vite.config.js):
laravel({
input: ['resources/js/app.js', 'resources/js/wire-sileo.js'],
// ...
}),
Then build your assets with Vite:
npm run dev
Use the facade in your Livewire components:
use Livewire\Attributes\On;
use Sileo\Facades\Sileo;
class MyComponent extends Component
{
public function success(): void
{
Sileo::success('Saved successfully');
}
public function action(): void
{
Sileo::action()
->title('New sale')
->description('A new order was placed.')
->button('View', 'openOrder', ['id' => $order->id])
->send();
}
#[On('deleteRecord')]
public function deleteRecord(): void
{
// Handle deletion
$this->record->delete();
}
}
| Method | Description |
|---|---|
Sileo::success($title, $description) |
Green success toast |
Sileo::error($title, $description) |
Red error toast |
Sileo::warning($title, $description) |
Amber warning toast |
Sileo::info($title, $description) |
Blue info toast |
Sileo::loading($title, $description) |
Loading state toast |
Sileo::danger($title, $description) |
Alias for error() |
All toast methods return a chainable builder:
Sileo::success()
->title('Success!')
->description('Your changes have been saved.')
->position('top-right') // or Position::TopRight
->duration(5000)
->theme('dark')
->fill('#1f2937')
->roundness(20)
->styles(['title' => 'text-white', 'description' => 'text-slate-300'])
->send();
| Option | Type | Description |
|---|---|---|
title |
string | Toast heading text |
description |
string | Toast body text (plain text) |
html |
string | Raw HTML content (renders HTML markup) |
position |
string | Position: top-right, top-center, top-left, bottom-right, bottom-center, bottom-left |
duration |
int/null | Display time in milliseconds. null disables auto-dismiss |
theme |
string | Theme: light, dark, or system (default: follows OS preference) |
fill |
string | Background color (CSS value like #1f2937 or Tailwind color like white) |
roundness |
int | Border radius in pixels (default: 16) |
styles |
array | Custom Tailwind classes: ['title' => '', 'description' => '', 'badge' => '', 'button' => ''] |
customClasses |
array/string | Additional CSS classes to apply to the toast container |
icon |
string | Icon name from lucide-react (e.g., rocket, check, info, alert-circle) |
For HTML in toast content, use the html() method (note: this renders raw HTML via dangerouslySetInnerHTML):
Sileo::success()
->title('Done!')
->html('<strong>Item</strong> was saved successfully.')
->send();
⚠️ Security: Only use trusted HTML content as it renders raw markup without sanitization.
Pass an icon name to replace the default state icon:
Sileo::success()
->title('Deployed!')
->icon('rocket')
->send();
Available icons: Any icon from lucide-react (use kebab-case: alert-circle, check-circle, loader-2, trash, etc.).
Pass an array with all options at once:
Sileo::success([
'title' => 'Success!',
'description' => 'Your changes have been saved.',
'position' => 'top-right',
'duration' => 5000,
'theme' => 'dark',
'fill' => '#1f2937',
'roundness' => 20,
'styles' => ['title' => 'text-white'],
])->send();
Toasts with a single interactive button:
Sileo::action()
->title('Delete record?')
->description('This cannot be undone.')
->fill('white')
->icon('trash')
->button('Delete', 'deleteRecord', ['id' => $id])
->styles([
'title' => '!text-red-500 font-bold',
'description' => '!text-red-400',
'badge' => '!bg-red-100 !text-red-700',
'button' => '!bg-red-100 !hover:bg-red-200 !text-red-700 !hover:text-red-800',
])
->send();
Note: Sileo action toasts only support a single button. Use button() for the action and set duration(null) if you want the toast to persist until interaction.
Promise toasts show a loading state that resolves or rejects based on your backend logic:
Fluent API:
use Livewire\Attributes\On;
class MyComponent extends Component
{
public function triggerSave(): void
{
Sileo::promise()
->event('saveRecord')
->loadingOptions(['title' => 'Saving...', 'description' => 'Please wait'])
->successOptions(['title' => 'Saved!', 'description' => 'Record updated'])
->errorOptions(['title' => 'Failed!', 'description' => 'Could not save'])
->send();
}
#[On('saveRecord')]
public function saveRecord(): void
{
try {
$this->record->save();
Sileo::promiseResolve('saveRecord');
} catch (\Exception $e) {
Sileo::promiseReject('saveRecord');
}
}
}
Array API:
#[On('processData')]
public function processData(): void
{
try {
// Your logic here
Sileo::promiseResolve('processData');
} catch (\Exception $e) {
Sileo::promiseReject('processData');
}
}
public function triggerProcess(): void
{
Sileo::promise([
'event' => 'processData',
'loading' => ['title' => 'Processing...', 'description' => 'Please wait'],
'success' => ['title' => 'Done!', 'description' => 'Data processed'],
'error' => ['title' => 'Failed!', 'description' => 'An error occurred'],
])->send();
}
Resolving Promises:
// Resolve with optional data payload
Sileo::promiseResolve('eventName', ['message' => 'Custom message']);
// Reject with optional error data
Sileo::promiseReject('eventName', ['error' => 'Custom error']);
Add custom CSS classes to toast elements:
Sileo::success()
->title('Custom styled')
->customClasses(['font-bold', 'shadow-lg'])
->send();
Publish the configuration file:
php artisan vendor:publish --tag=wire-sileo-config
Configure defaults in config/wire-sileo.php:
return [
'position' => 'top-right',
'theme' => 'system',
'fill' => null,
'roundness' => 16,
];

MIT License
How can I help you explore Laravel packages today?