Iâve been struggling to find a way to hide a page on the sidebar. From what I have been discovering online, st.pages is the way to go. Although examples of code using âhide_pagesâ seemed non-existent, I did find the following somewhere but somehow I cant find the source of this anymore. Regardless I created a project with the following as the main app.py. I created a âpagesâ folder and put in sample pages called âExample Oneâ, âExample Twoâ and âOther appsâ.
The UI comes up and works fine but no pages are ever hidden. Any help finding a way to hide pages would be greatly appreciated.
import streamlit as st
from st_pages import add_page_title, hide_pages
add_page_title()
st.write(âThis is just a sample page!â)
selection = st.radio(
âTest page hidingâ,
[âShow all pagesâ, âHide pages 1 and 2â, âHide Other apps Sectionâ],
)
if selection == âShow all pagesâ:
hide_pages()
elif selection == âHide pages 1 and 2â:
hide_pages([âExample Oneâ, âExample Twoâ])
elif selection == âHide Other apps Sectionâ:
hide_pages([âOther appsâ])
st.selectbox(âtest_selectâ, options=[â1â, â2â, â3â])