wezlo/filament-modal-notifications
Turn any Filament notification into a blocking modal by chaining ->asModal(). Modal notifications queue (no stacking), auto-add a Close button when no actions are set, respect your custom actions, support conditional opt-in, and offer panel-level defaults.
composer require wezlo/filament-modal-notifications
AppServiceProvider or PanelServiceProvider):
use Wezlo\FilamentModalNotifications\FilamentModalNotificationsPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
FilamentModalNotificationsPlugin::make(),
]);
}
->asModal():
Notification::make()
->title('Success!')
->body('Your action was completed.')
->success()
->asModal(); // <-- One-line change
config/filament-modal-notifications.php (auto-generated) for defaults like default_width or auto_close.filament-modal-notifications events in your browser’s DevTools (Network tab).Standard Notifications → Modals:
Replace Notification::make()->toast() with Notification::make()->asModal().
Example:
Notification::make()
->title('Warning')
->body('Are you sure?')
->warning()
->actions([
Action::make('Confirm')
->color('danger')
->action(fn () => $this->deleteRecord()),
Action::make('Cancel')
->action(fn () => Notification::make()->close()),
])
->asModal();
Conditional Modals:
Use ->asModal($condition) to fallback to a toast when needed:
if ($isCritical) {
Notification::make()->asModal();
} else {
Notification::make()->toast(); // Falls back to default
}
Queue Management: Modals auto-queue. Fire multiple notifications in a row:
Notification::make()->title('Step 1')->asModal();
Notification::make()->title('Step 2')->asModal(); // Waits for dismissal
->actions().$this->dispatch('filament-modal-notifications::render', data: [
'title' => 'Live Update',
'body' => $this->dynamicContent,
]);
FilamentModalNotificationsPlugin::make()
->defaultWidth('50%')
->autoClose(false)
->closeButtonLabel('Got it');
Session Key Conflicts:
filament-modal-notifications). If you manually clear sessions, modals may not render. Use Notification::make()->close() instead.Livewire Event Race Conditions:
->asModal()->delay(1000) (if supported).Action Button Overrides:
->actions(), the auto-added "Close" button disappears. Add it explicitly if needed:
->actions([
Action::make('Close')->action(fn () => Notification::make()->close()),
]);
Filament 4 vs. 5:
icon()) may behave differently. Test in your target Filament version.filament-modal-notifications. Look for render or close events.dd(session('filament-modal-notifications'));
auto_close: false in config to inspect modal behavior without dismissal.Custom Modal Views: Override the default modal template by publishing and modifying the view:
php artisan vendor:publish --tag=filament-modal-notifications-views
Edit resources/views/vendor/filament-modal-notifications/modal.blade.php.
Plugin Configuration: Extend the plugin class to add custom logic:
class CustomModalNotificationsPlugin extends FilamentModalNotificationsPlugin
{
public function register()
{
// Add custom Livewire listeners or session handlers
}
}
Conditional Rendering:
Use the rendered event to hook into modal lifecycle:
Notification::make()
->asModal()
->on('rendered', fn () => $this->logModalRender());
How can I help you explore Laravel packages today?