How to show/hide html elements in streamlit?

Hey @inba, Welcome to the community,

You can use the session state for this,

if not state.user:
    username = st.text_input(“User Name:”,value="")
    password = st.text_input(“Password:”, value="", type=“password”)
    state.user = authenticate(username, password)
else:
    st.write(f"Hey {state.user.name} !")

For reference of Session state, Multi-page app with session state
Hope it helps !

1 Like