I am using Streamlit’s new multi-page feature for an application.
I have a script in my ‘/Pages’ folder which I want to use but do not want it to be shown in the item menu.
Is there a solution to hide a specific page from the items menu but for it to still exist? I would like to access it using a button.
Currently, all scripts in the
/pages directory are assumed to be pages, and they will be displayed in the item menu. If you want to access pages with st.button, there’s this
switch_page available in streamlit-extras (see demo here)
Can I ask you more on your use-case? Curious to know why you’d like to have this functionality.
Thank you very much for your response.
switch_page is a great tool but unfortunately it doesn’t solve my problem.
I have a different page which consists of a huge DataFrame which is to be used by the user only to provide help to fill a text box on the main page. (for example, if I have to enter a key on the main page in a text box, this other page consists of various keys with their values. The user should be able to press this button, get all the values in the dataframe in a different tab and choose the value to reference it by its key)
Hence, I would like to open this page using a button(in a new tab as I do not want to disturb the progress on the main page) and there’s no point in displaying this all the time in the items menu.
@nishantseh I understand your point. You’re looking for “optional” content. Currently, pages are not optional unfortunately. But you can also take advantage of other layout primitives like:
Hope that helps,