-
Hi i have a complex, custom form page where on a click of a button i want to open a modal with some extra data. Can x-filament::modal be used for this? It's not an action so i need to be opened on a click of a custom button ( I tried using this instructions for wire-elements/modal, but while the screen was graying out on opening the modal, meaning the overlay was opening the actual modal was not visible on the page. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
For example, if you wanted a form modal: <form wire:submit.prevent="livewireSubmitMethodHere">
<x-filament::modal>
<x-slot name="trigger">
<button type="button" x-on:click="isOpen = true">Open</button>
</x-slot>
<x-slot name="header">
Modal heading
</x-slot>
Form components here
<x-slot name="actions">
<button type="submit">
Submit form
</button>
</x-slot>
</x-filament::modal>
</form> But you can strip out the form stuff and use it for any use case There are also browser events you can use to open and close the modal dynamically based on its ID. Check out |
Beta Was this translation helpful? Give feedback.
-
Hi all! To close inside the Component you can call:
And here is a good example using a form and a modal:
|
Beta Was this translation helpful? Give feedback.
-
For me, this works: dispatchEvent( new CustomEvent('open-modal', { detail: { id: 'conferma-acquisto', } }) ); |
Beta Was this translation helpful? Give feedback.
-
Just a quick note for people coming from search engine, this worked:
instead of:
|
Beta Was this translation helpful? Give feedback.
For example, if you wanted a form modal:
But you can strip out the form stuff and use it for any use case
There are also browser events you can use to open and close the modal dynamically based on its ID. Check out
mod…