wire-elements/modal
Livewire v3 modal component for Laravel that supports stacked/nested child modals while preserving state. Install via Composer, dispatch openModal events to launch components with arguments, and use wire-elements-modal in your layout.
Start by installing the package via Composer:
composer require wire-elements/modal
Then, add the Livewire directive @livewire('wire-elements-modal') to your main layout (just before </body>). Next, generate a modal component using php artisan make:livewire EditUser, and extend LivewireUI\Modal\ModalComponent instead of the default Component. From there, open the modal by dispatching 'openModal' events—e.g., wire:click="$dispatch('openModal', { component: 'edit-user', arguments: { user: 5 } })".
Use modal components like standard Livewire components but with lifecycle hooks for stack management:
openModal from inside another modal to open a child (e.g., confirm dialog from an edit form).$this->skipPreviousModal() before $this->closeModalWithEvents([...]) to avoid jumping back to intermediate steps (e.g., after deleting a record).public User $user) or mount() args to auto-resolve models from DB.closeModalWithEvents() to broadcast events to other Livewire components (e.g., UserOverview::class => 'userModified').modalMaxWidth() or disable default behaviors (closeModalOnEscape, closeModalOnClickAway) statically in your modal class.closeModalOnEscapeIsForceful() lets you navigate backwards in the stack without closing the entire stack.destroyOnClose() to true if you want fresh state on re-open (e.g., for CRUD forms).max-w-* classes to your safelist to prevent PurgeCSS from stripping needed styles.view:clear after upgrading from v2 to v3—especially since event names changed from $emit to $dispatch.closingModalOnEscape and closingModalOnClickAway events in @script blocks to block closing when form state is dirty.--tag=wire-elements-modal-config; existing configs from livewire-ui/modal won’t work.How can I help you explore Laravel packages today?