anish/resizable-modal
Composer 安装命令:
composer require anish/resizable-modal
包简介
Filament v4/v5 plugin for resizable action modals using native Width breakpoints
README 文档
README
Filament v4/v5 plugin that adds drag-to-resize handles on action modals. Width snaps through Filament's native Width breakpoints (fi-width-* classes), so resized modals behave the same as ->modalWidth(Width::*).
Inspired by asmit/resized-column resized-column.
Requirements
- PHP 8.2+
- Filament v4 (Livewire v3) or Filament v5 (Livewire v4)
- Laravel 10+ with Filament v4, or Laravel 11+ with Filament v5
Features
- Corner resize handles on all four modal corners
- Snaps to Filament
Widthenum breakpoints (3xsthroughscreen-2xl) - Persists per-action width in
localStorage(optional) - Works on table, header, bulk, and view actions with forms
- Global registration or per-action opt-in
- Panel plugin or standalone configuration
Works with
- Record actions (row actions)
- Bulk actions
- Header actions (list & view pages)
CreateActionEditAction(with->modal())- Custom
Action::make()with schema
Skipped when
- Confirmation-only (no form)
- Slide-over modals
Width::Screen- Plugin disabled
Compatibility
| Filament | Livewire | Laravel | Status |
|---|---|---|---|
| v4.x | v3 | 10+ | Supported |
| v5.x | v4 | 11+ | Supported |
The same APIs are used on both versions: Action::configureUsing(), extraModalWindowAttributes(), hasFormWrapper(), Filament\Support\Enums\Width, and PanelsRenderHook::SCRIPTS_AFTER. No version-specific configuration is required.
Installation
composer require anish/resizable-modal
Register the plugin in your panel provider:
use Anish\ResizableModal\ResizableModalPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ ResizableModalPlugin::make(), ]); }
Publish config (optional):
php artisan vendor:publish --tag=resizable-modal-config
Configuration
// config/resizable-modal.php return [ 'enabled' => true, 'register_on_actions' => true, 'persist_in_local_storage' => true, 'local_storage_prefix' => 'filament.resizable-modal', ];
Plugin methods
ResizableModalPlugin::make() ->enabled(fn (): bool => true) ->registerOnActions(true) ->persistInLocalStorage(true) ->localStoragePrefix('my-app.resizable-modal') ->resizableWidths(['sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', '7xl']);
Standalone (without panel plugin)
// app/Providers/AppServiceProvider.php use Anish\ResizableModal\ResizableModalPlugin; public function boot(): void { ResizableModalPlugin::standalone() ->persistInLocalStorage(true); }
Per-action opt-in
Disable global registration and attach manually:
// config/resizable-modal.php 'register_on_actions' => false, // On a specific action: use Anish\ResizableModal\Support\ResizableModal; Action::make('edit') ->extraModalWindowAttributes(ResizableModal::extraAttributes(), merge: true);
Eligible modals
Resize is applied when all of the following are true:
- Action has a form wrapper (schema)
- Not a confirmation-only modal
- Not a slide-over
- Modal width is not
Width::Screen
Usage
- Open any eligible action modal.
- Drag any corner handle diagonally to change width.
- Double-click a corner handle to reset to the action's default width.
Troubleshooting
If handles appear but resize does nothing:
- Hard refresh the browser (Ctrl+Shift+R).
- Clear stale localStorage keys from older versions:
Object.keys(localStorage) .filter((key) => key.includes("resizable-modal")) .forEach((key) => localStorage.removeItem(key));
License
MIT. See LICENSE.txt.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-24
