Pros:
<x-wiremodal>), aligning with modern Laravel conventions.CustomEvent dispatching for modal lifecycle, enabling tight integration with Livewire’s event system.Cons:
wiremodal:opened events for data passing; complex state (e.g., nested modals, dynamic content) may require additional logic.$this->openModal()/$this->closeModal() macros simplify Livewire component interactions.dispatch() under the hood, ensuring consistency with existing event-driven workflows.wiremodal:opened events bridges Livewire properties and modal content dynamically.x-data and event listeners (@wiremodal:opened) enable two-way binding with minimal boilerplate.Wiremodal.open()/close() provides a familiar modal API for non-Livewire contexts (e.g., static pages, SPAs).wiremodal:beforeclose handlers could conflict with existing event listeners (mitigated by namespacing).Modal Workflow Complexity:
State Synchronization:
wiremodal:opened events, Livewire properties, or a hybrid approach?Theming Consistency:
Accessibility:
Performance:
Migration Path:
open-modal)?Testing Strategy:
$this->openModal('confirm-delete').$this->openModal('edit-task', ['id' => 123]).wiremodal:closed event or use Wiremodal.close() Promise.@click="Wiremodal.open('modal-name', { data })".x-data="{ payload: {} }" @wiremodal:opened.window="payload = $event.detail.data".window.dispatchEvent(new CustomEvent('open-wiremodal', { detail: 'modal-name' })).await Wiremodal.open('modal-name').<x-wiremodal>.open-modal/close-modal) during transition to avoid breaking changes.wiremodal vs. legacy APIs:
class ModalService {
public static function open(string $name, array $data = []): void {
if (config('app.use_legacy_modals')) {
// Dispatch legacy event
} else {
app('livewire')->openModal($name, $data);
}
}
}
@import for CSS/JS (as shown in README).<link>/<script> tags (no transpilation needed).php artisan vendor:publish --tag=wiremodal-assets.<link href="{{ asset('vendor/wiremodal/css/wiremodal.css') }}">.<html data-wire-theme="claude">.<x-wiremodal>.$this->openModal().wiremodal:closed for Livewire actions).How can I help you explore Laravel packages today?