F
Filament16mo ago
DivDax

Load component into Action modal?

Hey! Can a component be passed to an action instead of a view?
6 Replies
awcodes
awcodes16mo ago
Pretty sure that’s a no. You can use a form in an action though without a view. But you can’t pass blade components
Patrick Boivin
Patrick Boivin16mo ago
What would this look like though, would you pass the class name of your Blade component? What about the props?
DivDax
DivDaxOP16mo ago
I wanted to load a Livewire component instead of a blade view in a modal that is opened through the action. Something like this: ViewAction::make()->modal()->component(LivewireComponent::class)
Patrick Boivin
Patrick Boivin16mo ago
Oooh a Livewire component. Yeah, I think you need to wrap it in a Blade view...
awcodes
awcodes16mo ago
The problem there would be that you can’t instantiate a LW component. It has to be rendered by blade. And if it tries to render too early it will just throw an exception.
DivDax
DivDaxOP16mo ago
Ok, I understand. But it feels wrong to use a blade file just to load an LW component. Couldn't we solve this more elegantly by using a kind of placeholder blade template specifically designed for such cases, so that we don't need an additional blade file for every LW component we want to open in a modal?
Want results from more Discord servers?
Add your server