Delete Text and other components

Hello everyone, after clicking in the login button, how do i delete all the login details( everything under “Login Section”) and substitute with other text and buttons, widgets , etc…

like: if button and login == Correct: “delete everything above login section”

The easiest way is probably just not showing them.

def main():
    if st.session_state.setdefault("user", None) is None:
        user = st.text_input(label="User")
        password = st.text_input(label="Password", type="password")
        if st.button(
            label="Login", on_click=on_login_click, args=(user, password)
            st.error("Invalid user name or password.")
        st.success(f"Welcome, {st.session_state['user']}!")
        st.button("Logout", on_click=on_logout_click)

def on_login_click(user, password):
    if authenticate(user=user, password=password):
        st.session_state["user"] = user

def on_logout_click():
    st.session_state["user"] = None

def authenticate(user, password):
    return user == "Tiago" and password == "123"

if __name__ == "__main__":