It works very often. However, it sometimes hangs and the sidebar is visible for about 4 seconds. Can anyone explain why it sometimes takes so long? I don’t want the user to be able to click on the side bar and 4 seconds is too long.
Is this a multi page app, otherwise if no elements were assigned to the sidebar (e.g. via st.sidebar.write()) it should not be displayed.
Another way is to customize the CSS so that the sidebar is hidden permanently. Check out the following YouTube video for a walkthrough on how to implement this:
Thank you for the response. Yes, it is a multipage site. However, I want to control the flow of the page switch, so I don’t want users to be able to jump to a random page.
After looking through your video, I get that I can write a CSS file, use the CSS to disable the sidebar element, and load the CSS file in the code.
The issue that I have is the element name of the div. Since it only appears for 3 seconds, i can’t seem to find it. Should it still be there in the code? After I disable it?
There are some new updates on this with the latest release! As of 1.30.0, you can now program page switching with st.switch_page() as well as disable the sidebar navigation.
More info in the docs. Looking forward to hearing what you think!
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.