Download the PHP package wezlo/filament-modal-notifications without Composer
On this page you can find all versions of the php package wezlo/filament-modal-notifications. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wezlo/filament-modal-notifications
More information about wezlo/filament-modal-notifications
Files in wezlo/filament-modal-notifications
Package filament-modal-notifications
Short Description Render any Filament notification as a blocking modal by chaining ->asModal() onto the native Notification API.
License MIT
Informations about the package filament-modal-notifications
Filament Modal Notifications
Render any Filament notification as a blocking modal by chaining one method: ->asModal(). Multiple modal notifications fired in the same request are queued one at a time — the user dismisses one and the next slides in, no stacking.
Everything else you already know about Filament notifications (title, body, icon, color, actions, danger()/success()/warning()/info()) carries over unchanged.
Requirements
- PHP 8.2+
- Laravel 11+ / 13
- Filament 4 or 5
Features
- One-line opt-in — chain
->asModal()onto anyNotification::make()call. No new classes to learn. - Queued — multiple modal notifications show one at a time, dismissal advances to the next.
- Auto-added Close button — if the developer didn't declare actions, the modal gets a "Close" button in its footer so it's always dismissible.
- Respects your actions — if you declare
->actions([...]), those render in the footer instead. - Conditional —
->asModal($isCritical)is a no-op when the condition is false, so the notification sends as a regular toast. - Independent of the toast tray — modal notifications never briefly flash as toasts; they use a dedicated session key and Livewire event.
- Plugin-level defaults — set the default modal width, closable behavior, and close button label per panel.
Installation
Register the plugin on your panel so the Livewire component mounts at the page footer:
Optionally publish the config:
Quick Start
That's it. On the next Livewire cycle, a modal opens with the title, body, and a default Close button. Regular toasts still work exactly as before — only notifications with ->asModal() go through the modal pipeline.
Usage
With custom actions
The notification's actions render in the modal footer:
When any action's ->close() is invoked (or the user clicks X / Esc / clicks outside if closable), the queue advances to the next pending modal notification.
Conditional modal
->asModal(false) leaves the notification as a normal toast:
Queued — multiple in one request
The user sees one modal at a time in FIFO order. Each dismissal advances to the next. When the queue is empty the modal closes.
Panel-level defaults
| Method | Type | Default | Description |
|---|---|---|---|
defaultWidth(Width\|string) |
enum/string | md |
Modal width (sm, md, lg, xl, 2xl, …, screen) |
defaultClosable(bool) |
bool | true |
Whether the modal can be dismissed via X, Esc, or click-away |
defaultCloseButtonLabel(string) |
string | Close |
Label for the auto-added Close action |
Default Config File
How It Works
->asModal()is a macro registered onFilament\Notifications\Notificationin the service provider. It returns aWezlo\FilamentModalNotifications\ModalNotification— a subclass that overridessend()to push into a dedicated session key (filament.modal-notifications) instead of the defaultfilament.notifications.- A custom dehydrate hook dispatches the
modalNotificationsSentLivewire event when the modal session key has pending notifications (same pattern Filament uses for its toast tray). - A Livewire component (
Wezlo\FilamentModalNotifications\Livewire\ModalNotifications) mounts atPanelsRenderHook::BODY_END. It listens formodalNotificationsSent, drains the session key into an in-component queue, and renders the first pending notification through<x-filament::modal>. When the user dismisses the modal (X, Esc, click-away, or any action chained with->close()), the component advances to the next queued notification. - No toast flash — because modal notifications use a separate session key, the default toast tray never sees them.
License
MIT
All versions of filament-modal-notifications with dependencies
filament/filament Version ^4.0 || ^5.0
spatie/laravel-package-tools Version ^1.0