F
Filament3w ago
r0x

Modal opened without Action

is it possible to use something like this: public function openModalAction(): Action { return Action::make('openModalAction') ->modalHeading('Title') ->modalSubheading('subtitle') ->modalContent(view('modals.view')) ->modalButton('Close') ->action(fn () => null); } Without using a button? I created a Livewire Component and im using a section as a button. Can i open a modal ? He is not a "button" to use the Action. thanks
3 Replies
Lara Zeus
Lara Zeus3w ago
maybe use js sto do so
$dispatch('open-modal', { id: 'modal-id' })
$dispatch('open-modal', { id: 'modal-id' })
r0x
r0xOP3w ago
i do that. thats the approach im using atm. public function openModal(): void { $this->dispatch('open-modal', id: 'id-modal'); } but the thing is: with this approach, the CSS used by the modal is not the same we use when we set the Action::make()
binaryfire
binaryfire3w ago
Unfortunately I don't think that's possible with action modals. Modal IDs are random - they use the Livewire id. Eg. data-fi-modal-id="fi-CM5G36NzThLhI0h8EnI2-action-0"

Did you find this page helpful?