Hello,
I have st.text_input
But i want to hide it or make it invisible after i input something and enter
How to do it?
Thank you
Hello @arri, welcome to the community!
Check out the documentation for st.empty which should fit your need by destroying the text_input after pressing “Enter”! :
import streamlit as st
text_input_container = st.empty()
t = text_input_container.text_input("Enter something")
if t != "":
text_input_container.empty()
st.info(t)
Have a nice day!
Fanilo
Thank you andfanilo
Exactly what I was looking for, thanks Fanilo!
Funnily enough I would probably do this with session state now XD
EDIT:
import streamlit as st
text_input_container = st.empty()
text_input_container.text_input("Enter something", key="text_input")
if st.session_state.text_input != "":
text_input_container.empty()
st.info(st.session_state.text_input)
wow, this function is similar with pywebio.
The conversation function is really convenient!
Really handy Fanilo, thank you!