Ask the community or our support engineers for answers to questions.
is that a way to overwrite or clear user input value by click a button?
for example, by click the button, clear the text input value.
Ask the community or our support engineers for answers to questions.
is that a way to overwrite or clear user input value by click a button?
Yes, you can store the value of the click and if its true, set the value of the text input to blank.
import streamlit as st
placeholder = st.empty()
input = placeholder.text_input('text')
click_clear = st.button('clear text input', key=1)
if click_clear:
input = placeholder.text_input('text', value='', key=1)
This works for me. Does it answer your q?
Dinesh
it works, thanks. another trick in streamlit. it is amazing. Thanks.