Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Foks's avatar
Level 15

Searchable select input

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?

0 likes
12 replies
Foks's avatar
Level 15

More like Select2, if you know it

Foks's avatar
Level 15

I don't like the way it's made, I'd prefer a Livewire component instead.

CorvS's avatar

@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.

Foks's avatar
Level 15

@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?

CorvS's avatar

@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)?

Foks's avatar
Level 15

@corvs There are some cases where I'd like it to be initially, but others where when the user actually enters something.

Foks's avatar
Level 15

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.

Please or to participate in this conversation.