Completely disable sidebar?

Hey! Is there a way to completely hide the sidebar in a streamlit app (or even on a single page), or atleast hide the icon on the page which triggers the bar.

Hey @NoNeuronsNoStress, you probably want to use the initial_sidebar_state="collapsed" keyword in st.set_page_config(). See docs st.set_page_config - Streamlit Docs

Hope that helps,
Arnaud

1 Like

Hey @arnaud, is there a way where it can actually be disabled? This approach hides it initially but it can still be expanded.

One option is to hide the expander with css

import streamlit as st

st.set_page_config(initial_sidebar_state="collapsed")

st.markdown(
    """
<style>
    [data-testid="collapsedControl"] {
        display: none
    }
</style>
""",
    unsafe_allow_html=True,
)
4 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.