#7807·streamlit

Typeahead/autocomplete (async) st.selectbox / st.text_input widget

Author: sfc-gh-bhayCreated Dec 5, 2023Updated Sep 17, 2026
Labelstype:enhancementfeature:st.selectboxfeature:st.text_inputtype:possible-component

Checklist

  • I have searched the existing issues for similar feature requests.
  • I added a descriptive title and summary to this issue.

Summary

This would be a standard typeahead/autocomplete text input. Imagine the st.selectbox widget, but instead of showing a list of static elements the dropdown, the options are queried from a backend service based on the user's text input. As the user types in characters, the options in the dropdown menu are updated.

Why?

Often times I want to allow a user to select from a large list of options (>1k). Depending on the data size, it's prohibitive to load all those options into memory at once and display them. Even if the data size of the options is less than the Streamlit memory limit, it often significantly slows down the responsiveness of my Streamlit app.

The standard solution for this in web applications is to wait for the user to begin typing some minimum number of characters, and then query a backend data source with the user's input filter applied. This narrows down the available options and limits the load on the network and browser memory.

It would be great if Streamlit had a native widget similar to st.selectbox where the datasource for options could be a backend query/api call and the on_change handler would trigger it and load new options.

How?

This functionality would be a bit of a departure from the standard Streamlit runtime model, because it would require rerunning a specific function, and not the entire Streamlit script. Until there is some solution for that in place, I don't really think this feature I'm asking for is feasible.

Assuming the ability to do a partial rerun is adopted into Streamlit, then I could imagine a modification to st.selectbox would work, where the options could be a function call to some backend service (either an api or a database query) that would return an array. Then the on_change function would trigger the call to get new options.

Additional Context

No response