dispatch('openModal', component: 'modals.confirm', arguments: [ * 'title' => ..., 'body' => ..., 'confirmLabel' => ..., 'event' => 'someEvent', 'danger' => true, * ]); * On confirm it dispatches `event` (caught by the opener via #[On('someEvent')]) and closes. */ class Confirm extends ModalComponent { public string $title = ''; public string $body = ''; public string $confirmLabel = ''; public string $event = ''; public bool $danger = false; public static function modalMaxWidth(): string { return 'md'; } public function mount(string $title, string $body, string $confirmLabel, string $event, bool $danger = false): void { $this->title = $title; $this->body = $body; $this->confirmLabel = $confirmLabel; $this->event = $event; $this->danger = $danger; } public function confirm(): void { $this->dispatch($this->event); $this->closeModal(); } public function render() { return view('livewire.modals.confirm'); } }