How to show livewire component as modal window for filament table action
I am going to show a livewire component in modal window when user clicks a filament table action.
When clicked assign button, I want to show a modal window and the use a livewire component as modal window content. I tried to find the solution and looked around filament table actin docs, but I couldn't find. Please help me to find what functions to call for making custom filament table action for showing a livewire component in modal window.
Solution:Jump to solution
this?
```php
Action::make('assign')
->icon('heroicon-o-trash')
->modalcontent(new HtmlString(Blade::render('@livewire('my-component')')))...
18 Replies
I know Action->form() but how can I load livewire component as modal using that function?
did you try
->modalContent()
?Yes, but that only can include a blade file
But I want to load a livewire component. 😦
try
Blade::render('@livewire(\'my-component\')')
let me try now.
do you mean to call like this?
actually this:
Yes, I made as you wrote but no modal appears when I click Assign
->action(function() {})
The same.
create a blade file and load the component in it using @livewire and load the blade using
modalContent
Solution
this?
That works great. Please help more. How can I pass variable to livewire there?
I want to pass
id
of record to livewire.
I made it working. Thanks friend. Can I add you as friend?you can't add people on support 🙂
what do you mean and who are you?
Really Thanks
you can pass additional parameters
https://laravel-livewire.com/docs/2.x/rendering-components
something like this:
Livewire
Rendering Components | Livewire
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
Yes. Please accept me
I sent you request
did you try the code?
no worries, but if you have questions, please ask on #❓┊help and check the #✅┊rules