Streamlit Pages

Streamlit Pages allows us to create multi-pages apps for better navigation, structure and modularity.
It helps us split our app into smaller pages.
Some benefits of Streamlit Pages includes
Organized structure for large apps.

Easy navigation through sidebar or custom menus.

Reusable logic across pages.

Better user experience.

Setting up pages
Streamlit automatically recognizes a pages directory inside an app folder.
Each Python file inside the folder becomes a new page

Project Structure Example
my_app/
│── Home.py
│── pages/
│ ├── 1_About.py
│ ├── 2_Dashboard.py
│ └── 3_Contact.py

Home.py is the default page
pages/1_About.py appears as “About”
Numbers (1_, 2_) controls the order.
 
 
 
Need a Streamlit developer?:Click Here 

Example Home Page

				
					import streamlit as st

st.title("Welcome to my Home Page")
st.write("Use the sidebar to navigate between pages")

				
			
				
					import streamlit as st


st.title("About")
st.write("This page provides information about the app")
				
			
				
					import streamlit as st



st.title("Dashboard")
st.write("This is the Dashboard page")


				
			
				
					import streamlit as st



st.title("Contact")
st.write("This is the Contact page")


				
			

Custom Navigation with Buttons

				
					import streamlit as st

page = st.sidebar.radio("Navigate", ["Home", "About", "Dashboard"])
if page == "Home":
    st.write("Home Page")
elif page == "About":
    st.write("About Page")
elif page == "Dashboard":
    st.write("Dashboard Page")

				
			

Learn more about Streamlit?: Click Here

 

Watch videos on Streamlit:

Leave a Reply

Your email address will not be published. Required fields are marked *