Join the Webstudio community

Updated 2 months ago

Creating an Auto-complete Feature for a Dropdown in Webstudio

At a glance
Hey everyone ! Hope you're doing well πŸ™‚

I'm searching for a way to create an auto-complete feature for a dropdown in Webstudio (similar to the one in the screenshot I attached).

What would be the way to do this in Webstudio ? I haven't found anything in the docs :/

For info the search results are cities in France, stored in my app's Databse that I can call through a GET
Attachment
CleanShot_2024-10-28_at_14.30.142x.png
O
T
b
7 comments
Currently you would need to use something like Downshift or any other library on the client and fetch the data from the API from the client as well.

There is not much Webstudio is helping with in this case since we don't have a pre-made component for this.
Hey Oleg ! Arf, okay thanks, I'm gonna search into this !

Another idea I had in mind was to try using a "Select" component from Radix in coordination with a text input.

I'd use the text input's value as a constraint for the GET that populates a collection inside the "Select" component.

Do you think it could work ? (I'm trying it, but struggling to retrieve the input's value with Javascript)
Autocomplete/combobox is quite different than just select and input
Hmmm okay I see.

I'm gonna try and find something then, thanks for your answer !
You can use custom code of accordation(html) - <summary> and try to populate it with the data you are fetching- that code can be in <script> that is js which will be making a list of summaries, or <p> as per your choice.

I hope i have understood your question, if not let me know.
Update : I ended up coding it from scratch. It's not perfect, but that'll do for now πŸ™‚

Might be a good component to add to Webstudio in my opinion 😁

https://www.lokka-immo.com/
its always great if its working XD
Add a reply
Sign up and join the conversation on Discord