Introduction
Filament’s notification system allows you to send flash notifications to users that appear in the corner of the screen. Notifications are built using a fluent API and can be sent from anywhere in your application - Livewire components, controllers, jobs, or even JavaScript.Sending a basic notification
Create and send a notification using themake() method:
Notification content
Status and icons
Notifications can display status indicators with appropriate icons and colors:Custom icons
Set a custom icon and color:Background colors
Add a background color to make notifications more prominent:Duration and persistence
Notification actions
Add interactive buttons to your notifications:Opening URLs
Actions can open URLs when clicked:Dispatching Livewire events
Trigger Livewire events from notification actions:dispatchSelf() and dispatchTo():
Sending from JavaScript
Create notifications from JavaScript using the globalFilamentNotification object:
Importing in bundled JavaScript
If you’re using a JavaScript bundler:Closing notifications
Close a notification programmatically by dispatching a browser event:Using random IDs is recommended to avoid accidentally closing the wrong notification. Only use custom IDs when you can guarantee uniqueness.
Positioning notifications
Configure the global position of notifications in a service provider or middleware:- Horizontal:
Alignment::Start,Alignment::Center,Alignment::End - Vertical:
VerticalAlignment::Start,VerticalAlignment::Center,VerticalAlignment::End