Select of examples overwriting text_input

A standard thing for NLP demos is to have a selectbox of example inputs which autofill a text_input which the user can then edit and submit.

Here’s some examples:

Is there a way to overwrite a text_input when a select box changes?

I see people already asking for a variant of this. (Before anyone suggests, streamlit-tags is not the solution here)

1 Like

Hi - welcome to Streamlitdom.

Perhaps something like this will help?

actions = ['Action 1', 'Action 2', 'Action 3']
action = st.sidebar.radio('Select action', actions)

options = {actions[0]: ['1-1', '1-2', '1-3'], actions[1]: ['2-1', '2-2', '2-3'], actions[2]: ['3-1', '3-2', '3-3']}
option = st.selectbox('Select option', options[action])

selectbox isn’t editable, but you could add a text_input field to override option selections.