Conditional Fields?

Hey I’m new to Laravel and Livewire and I’ve funded Caleb as this looks awesome!

I’ve successfully used it a few components already but I now need to build a user form that has conditional fields. (They show / hide conditionally based on user input)

Can I do all of this with livewire and alpine js? I’m currently using this: in the project I’m migrating over to Laravel but it’s obviously jQuery based and not linked in with livewires validation

Just wondering if I’ve missed something simple in livewire or Laravel that shows an example of doing this?

IE select “yes” from a dropdown to show other inputs… and if no is selected any input currently shown is hidden and made blank?

OR show X amount of new inputs based on a Select like “4” to build 4 new fields?


The beauty of Livewire is that you do not need any jQuery or any other JS libraries for conditional things. Basically you need to connect your choice to a model wire:model="myChoice" and in the render() method of your component return a form with needed amount of inputs/controls/etc according current value of $myChoice or anything else.