An experimental version of Streamlit Multi-Page Apps
Project description
Streamlit-Pages
Installation
pip install st-pages
Why st-pages?
Streamlit has native support for multi-page apps where page filenames are the source of truth for page settings.
But, you might want to be able to change the names, icons or order of your pages without having to rename the files themselves.
This is an experimental package to try out how page-management might work if you could name the pages whatever you wanted, and could manage which pages are visible, and how they appear in the sidebar, via a setup function.
This enables you to set page name, icon and order independently of file name/path, while still retaining the same sidebar & url behavior of current streamlit multi-page apps.
How to use
Method one: declare pages inside your streamlit code
from st_pages import Page, show_pages, add_page_title
# Optional -- adds the title and icon to the current page
add_page_title()
# Specify what pages should be shown in the sidebar, and what their titles and icons
# should be
show_pages(
[
Page("streamlit_app.py", "Home", "🏠"),
Page("other_pages/page2.py", "Page 2", ":books:"),
]
)
Method two: declare pages inside of a config file
Contents of .streamlit/pages.toml
[[pages]]
path = "streamlit_app.py"
name = "Home"
icon = "🏠"
[[pages]]
path = "other_pages/page2.py"
name = "Page 2"
icon = ":books:"
Streamlit code:
from st_pages import show_pages_from_config
show_pages_from_config()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.