PHPackages                             azgasim/filament-unsaved-changes-modal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. azgasim/filament-unsaved-changes-modal

ActiveLibrary

azgasim/filament-unsaved-changes-modal
======================================

Filament plugin: unsaved-changes prompts as Filament modals instead of browser confirm dialogs.

1.0.0(1mo ago)31↑2900%MITBladePHP ^8.2CI passing

Since Apr 5Pushed 1mo agoCompare

[ Source](https://github.com/AzGasim/filament-unsaved-changes-modal)[ Packagist](https://packagist.org/packages/azgasim/filament-unsaved-changes-modal)[ Docs](https://github.com/AzGasim/filament-unsaved-changes-modal)[ GitHub Sponsors](https://github.com/AzGasim)[ RSS](/packages/azgasim-filament-unsaved-changes-modal/feed)WikiDiscussions 5.x Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

[![Unsaved changes: Filament modal instead of the browser dialog](art/unsaved_thumb.png)](art/unsaved_thumb.png)

Filament Unsaved Changes Modal
==============================

[](#filament-unsaved-changes-modal)

[![Packagist Version](https://camo.githubusercontent.com/5b7fea298d06660ca67644a1bf52519abddb9f786f765b660d306eb5a4de7d79/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f617a676173696d2f66696c616d656e742d756e73617665642d6368616e6765732d6d6f64616c3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/azgasim/filament-unsaved-changes-modal)[![Packagist Downloads](https://camo.githubusercontent.com/dc2fed26089467fadd9f316cc196514c3c9b8ef0d68fd04a21ac990fd0f50368/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f617a676173696d2f66696c616d656e742d756e73617665642d6368616e6765732d6d6f64616c3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/azgasim/filament-unsaved-changes-modal)[![Tests](https://github.com/AzGasim/filament-unsaved-changes-modal/actions/workflows/run-tests.yml/badge.svg)](https://github.com/AzGasim/filament-unsaved-changes-modal/actions/workflows/run-tests.yml)[![Code style](https://github.com/AzGasim/filament-unsaved-changes-modal/actions/workflows/fix-php-code-style-issues.yml/badge.svg)](https://github.com/AzGasim/filament-unsaved-changes-modal/actions/workflows/fix-php-code-style-issues.yml)[![License](https://camo.githubusercontent.com/23a8bbd825be98973262226cd6b001de43de657c8d028bec0407d7549c1631a9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f417a676173696d2f66696c616d656e742d756e73617665642d6368616e6765732d6d6f64616c3f7374796c653d666c61742d737175617265)](LICENSE.md)

In the Filament panel, leaving a dirty form shows a **Filament modal**instead of the browser’s blocking confirmation dialog.

Reloading or closing the tab still uses the native browser prompt (which cannot be customized).

[![Filament unsaved changes modal preview](art/preview.png)](art/preview.png)

Works with **Filament SPA** (`livewire:navigate`) and **normal full-page** navigation (same-origin link clicks in the panel body). Uses the same dirty-state rules as Filament’s [`unsavedChangesAlerts()`](https://filamentphp.com/docs/5.x/panel-configuration#unsaved-changes-alerts); this package only swaps the confirmation UI.

### Compatibility

[](#compatibility)

PluginFilamentPHP**1.x****^5.3.5****^8.2**Requires **Filament 5.3.5+** due to a known XSS vulnerability ([CVE-2026-33080](https://github.com/filamentphp/filament/security/advisories/GHSA-vv3x-j2x5-36jc)) in earlier versions.

Installation
------------

[](#installation)

```
composer require azgasim/filament-unsaved-changes-modal
```

Usage
-----

[](#usage)

You need **both** `unsavedChangesAlerts()` and this plugin on the same panel.

```
use AzGasim\FilamentUnsavedChangesModal\FilamentUnsavedChangesModalPlugin;

return $panel
    // … your existing panel configuration …
    ->unsavedChangesAlerts()
    ->plugin(FilamentUnsavedChangesModalPlugin::make());
```

You can also register the plugin inside `->plugins([...])` with your other plugins.

Customization
-------------

[](#customization)

### Modal appearance

[](#modal-appearance)

Defaults live on `[FilamentUnsavedChangesModalPlugin](src/FilamentUnsavedChangesModalPlugin.php)`: `DEFAULT_MODAL_WIDTH`, `DEFAULT_MODAL_ICON_COLOR`, `DEFAULT_STAY_BUTTON_COLOR`, `DEFAULT_LEAVE_BUTTON_COLOR`, and an icon default of `OutlinedExclamationTriangle` when you do not call `modalIcon()`.

```
FilamentUnsavedChangesModalPlugin::make()
    ->modalWidth('xl')
    ->modalIcon('OutlinedExclamationTriangle')
    ->modalIconColor('danger')
    ->stayButtonColor('gray')
    ->leaveButtonColor('warning')
```

MethodValues`modalWidth()``xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl`, `5xl`, `6xl`, `7xl`, `full`, `min`, `max`, `fit`, `prose`, `screen-sm`, `screen-md`, `screen-lg`, `screen-xl`, `screen-2xl`, `screen` — same string values as Filament’s `Width` enum (`Filament\Support\Enums\Width`).`modalIcon()``Heroicon::OutlinedExclamationTriangle` or `'OutlinedExclamationTriangle'` (not `o-exclamation-triangle`)`modalIconColor()`, `stayButtonColor()`, `leaveButtonColor()``primary`, `success`, `danger`, `warning`, `info`, `gray`, … (your panel color keys)There is **no** published config file; configure the plugin with the methods above.

### Translations

[](#translations)

Heading, description, and the **Stay** / **Leave** labels are only customizable via **translations** (no plugin methods for copy). Publish and edit `unsaved-changes-modal.php` under your locale — keys live in `navigation.*`; see [English](resources/lang/en/unsaved-changes-modal.php) (package also ships `de`).

```
php artisan vendor:publish --tag="filament-unsaved-changes-modal-translations"
```

### Views

[](#views)

Only if you want to change the Blade markup, copy the package views into your app:

```
php artisan vendor:publish --tag="filament-unsaved-changes-modal-views"
```

If you change the modal’s DOM `id` in a published view, keep it in sync with `[MODAL_DOM_ID](src/FilamentUnsavedChangesModalPlugin.php)` and the [script hook view](resources/views/hooks/unsaved-changes-script-overrides.blade.php) (the script opens and closes the modal by that `id`).

### Skipping the prompt for a link

[](#skipping-the-prompt-for-a-link)

Add `data-skip-unsaved-changes-modal` on the `` **or on any ancestor element** (the listener uses `closest(...)`).

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

[CHANGELOG.md](CHANGELOG.md)

Contributing
------------

[](#contributing)

[CONTRIBUTING.md](.github/CONTRIBUTING.md)

Security
--------

[](#security)

[SECURITY.md](.github/SECURITY.md)

Credits
-------

[](#credits)

- [Aziz Gasim](https://github.com/AzGasim)
- [Contributors](https://github.com/AzGasim/filament-unsaved-changes-modal/graphs/contributors)

License
-------

[](#license)

[MIT](LICENSE.md)

###  Health Score

39

—

LowBetter than 87% of packages

Maintenance91

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

45d ago

Major Versions

1.0.0 → 5.x-dev2026-04-05

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/104441723?v=4)[Aziz Gasim](/maintainers/AzGasim)[@AzGasim](https://github.com/AzGasim)

---

Top Contributors

[![AzGasim](https://avatars.githubusercontent.com/u/104441723?v=4)](https://github.com/AzGasim "AzGasim (32 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

laravellivewiremodalfilamentfilament-pluginfilamentphpunsaved-changesAzGasimfilament-unsaved-changes-modalunsaved-changes-alert

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/azgasim-filament-unsaved-changes-modal/health.svg)

```
[![Health](https://phpackages.com/badges/azgasim-filament-unsaved-changes-modal/health.svg)](https://phpackages.com/packages/azgasim-filament-unsaved-changes-modal)
```

###  Alternatives

[croustibat/filament-jobs-monitor

Background Jobs monitoring like Horizon for all drivers for FilamentPHP

263255.2k6](/packages/croustibat-filament-jobs-monitor)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)[relaticle/custom-fields

User Defined Custom Fields for Laravel Filament

15828.6k](/packages/relaticle-custom-fields)[jibaymcs/filament-tour

Bring the power of DriverJs to your Filament panels and start a tour !

12247.8k](/packages/jibaymcs-filament-tour)[guava/filament-modal-relation-managers

Allows you to embed relation managers inside filament modals.

7565.0k4](/packages/guava-filament-modal-relation-managers)[asosick/filament-layout-manager

Allow users to create &amp; customize their own FilamentPHP pages composed of Livewire components

5718.8k2](/packages/asosick-filament-layout-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
