open a modal from a navigationitem

Hi. I would like to add a link in left navigation to open a modal and I put the link with this code in the file
AdminPanelProvider.php
AdminPanelProvider.php
public function panel(Panel $panel): Panel
{
return $panel
....
->navigationItems([
NavigationItem::make('Abrir')
->icon('heroicon-o-presentation-chart-line')
->group('Simuladores')
->sort(3)
->url('#'),

])
public function panel(Panel $panel): Panel
{
return $panel
....
->navigationItems([
NavigationItem::make('Abrir')
->icon('heroicon-o-presentation-chart-line')
->group('Simuladores')
->sort(3)
->url('#'),

])
The previous code shows the link (image attached), but I want to add something like this inside the link:
x-on:click=""
x-on:click=""
to open a modal with
$dispatch("open-modal", { id: "credit-simulator" })
$dispatch("open-modal", { id: "credit-simulator" })
assuming I have a modal with that ID. I have not found how to add that inside an Item of Navigation Panel. Thanks for reading and helping. Eday Gonzalez
link added
7 Replies
toeknee
toeknee2w ago
Doesn't seem possible at the moment. You could see if Dan would support a PR for ->extraAttributes()
ingeday
ingedayOP2w ago
Do you know if there is another way to do it other than a button in a widget?
toeknee
toeknee2w ago
I do not...
Firebat
Firebat2w ago
Well you could make a action that opens a modal at least
Firebat
Firebat2w ago
and you pretty much can customize them however you want, passing custom views, etc... https://filamentphp.com/docs/3.x/actions/modals
ingeday
ingedayOP2w ago
I will see it. Thank you.
Want results from more Discord servers?
Add your server