Tricks

Open a Wire Elements Modal from a Filament table action

May 27, 2023
Andréia Bohner
Table builder, Admin panel

You can open a Wire Elements Modal from an action using $livewire (the current Livewire component instance) to emit the openModal event, like so:

use Filament\Tables\Actions\Action;
 
protected function getTableActions(): array
{
return [
Action::make(__('View Details'))
->button()
->action(fn (User $record, $livewire) => $livewire->emit('openModal', 'show-user', ['user' => $record])),
...
];
}

No comments yet…