A few questions about multi-page applications

Hello!
My question is related to the new functionality - multi-page applications. This is really what I was missing in the standard library. Previously, I had to use different methods to achieve this, but now itโ€™s really easier. Thanks!

The question is how to hide the page or pages if the preconditions are not met? For example, authorization: this would be useful if the conditional report was intended for different user roles with sensitive data.

I also have a suggestion for page names in navigation. Since on every created page we can use .set_page_config method, i think itโ€™s possible to add an additional page_name parameter for this. It looks clearer and easier.

st.set_page_config(
    page_name=":robot_face: My Page Name",
)

Thanks!

1 Like

One hacky solution to manipulating what pages are shown in the sidebar is to use the get_pages function, which returns a dictionary with strings as keys, and dictionaries containing details about that page. Once this initial page list is generated, it is cached, and you can manipulate it in order to change the list of pages shown in the sidebar. If you create a function which deletes any entries that you would not like to be shown, this will also remove them from the sidebar.

We are working on some changes that should make this easier in the future.

2 Likes

Hey @kharlamarla,

thanks for your feedback, this is super helpful! Weโ€™ll be looking at ways how we can improve this first iteration of multipage apps over the next few months. Would love to get a bit more input from you on that. Would you be down to do a 20-30 min call over the next few weeks to tell me a bit more about how you use multipage apps?

Cheers, Johannes

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