Do you mean like a typeahead?
There is a tutorial here on Laracasts, with source available on Github
I'm currently working on an app that requires a searchable input, like where I can search states for a country in a form.
How would I go about it?
Do you mean like a typeahead?
There is a tutorial here on Laracasts, with source available on Github
More like Select2, if you know it
@foks Why not use Select2 then?
I don't like the way it's made, I'd prefer a Livewire component instead.
@foks Just be sure you understand the difference and you decide based on what's best for your case. With Livewire your search requires requests to the server, while a search input like Select2 is only client-side (JavaScript based). Maybe you want to look into Alpine.js, if you don't need/want to hit the server.
@corvs I need to fetch data from the server, upon loading, as the select is requiring data from the server.
Do you have any other recommendations?
@foks Right, that's what I was talking about. Do you want to fetch all "searchable" data initially and then the user can search client-side (Select2) or do you only want to fetch the data when the user actually enters something in the search field (Livewire)?
@corvs There are some cases where I'd like it to be initially, but others where when the user actually enters something.
Povilas has one here https://livewirekit.com/components/select2 but you need to buy the kit
Hmm, seems cool. But I'm currently interested in spending money on it, as I'm trying to learn as much of Livewire and AlpineJS as possible.
@Snapey Select2 has strange behavior with Modals.
Maybe this could be useful for anyone looking to achieve something like this https://www.youtube.com/watch?v=L_f9gNaSCRE
Please or to participate in this conversation.