Showing Widget in Modal

I have created a (chart) widget for a resource to show the stats of a (single) resource in a line chart. Is there a way to show this widget in a modal, when clicking on an Table (List records) Action? Somehing like:
Tables\Actions\Action::make("stats")
->widgets([
MyWidget::class
]);
Tables\Actions\Action::make("stats")
->widgets([
MyWidget::class
]);
1 Reply
bernhard
bernhardOP15mo ago
Nevermind. I can just use views for it:
Tables\Actions\Action::make("view")
->modalContent(fn($record) => view("detail-stats-modal", [
"record" => $record
]))
->label("Details"),
Tables\Actions\Action::make("view")
->modalContent(fn($record) => view("detail-stats-modal", [
"record" => $record
]))
->label("Details"),
and inside the view:
'<div>
@livewire(\App\Filament\Resources\AdAdvertorialResource\Widgets\AdvertorialClicksChart::class, ["record" => $record])
</div>
'<div>
@livewire(\App\Filament\Resources\AdAdvertorialResource\Widgets\AdvertorialClicksChart::class, ["record" => $record])
</div>
Want results from more Discord servers?
Add your server