Autocomplete Option for st.text_input()

Is there any way to have the text_input autocomplete from a column of strings in a DataFrame?

Hey @chefnewman!

For the text_input there currently isn’t a way to have it auto complete.

BUT if you’re looking to select a string from a column of strings in a DataFrame, where they can only use those specific strings, maybe select box or multi select will work for you? They allow you to populate a list of preselected options, and when you type into the field, they show options matching what you have typed so far. They also allow a dropdown box for people to look through all available options.

Here is when you start typing in the field:

Both of these widgets have this behaviour, the select box simply allows only one choice and multi select allows multiple selections!

Happy Streamlit-ing!


Works for me also. And just to add a useful note, st.multiselect is good for this since it also allows for blank selection (len(selector)==0) so that user can type in initial selection, or add additional ones.

1 Like

Hey @paulpax,

Do you happen to have a MWE for this?