Is there a way for a streamlit app to continuously update based on a text input without waiting for an explicit `ENTER` key press

Summary

Is there a way for a streamlit app to continuously update based on input from st.text_input (or other text input widgets) without requiring an ENTER key press?

Steps to reproduce

Code snippet:

# This is for illustration only but really this is an arbitrary (fast) function that takes a string as an input
def count_unicode_points(string):
   pass

st.text_input('Input a string to count the number of unicode points there are in the string', key="target_string")

st.text(f'There are {count_unicode_points(st.session_state.target_string)} unicode points in the input string')

Expected behavior:

The text that the streamlit app display will continuously update as the user types their input.

Actual behavior:

Currently, users have to press ENTER for the app to re-evaluate and render the updated text

Additional information

This is a feature request

You could use a custom component called streamlit-keyup that gives you the behavior you intend.

–Carlos

Thank you!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.