Course contentsShow
← Data Science
Lesson 1336 of 2,14533. Advanced Visualization TechniquesFree lesson

Multi-Page Dashboards and Navigation

Create multi-page apps in Streamlit and Dash with navigation, tabs, and organized content sections.

Multi-Page Dashboards and Navigation

You'll learn how to organize complex dashboards into multiple pages with navigation systems in Streamlit and Dash.

When your dashboard grows beyond a single screen of widgets and charts, breaking it into multiple pages makes it more usable and maintainable. Think of it like a website: instead of cramming everything onto one endless homepage, you create separate pages (Home, About, Data Explorer, etc.) with clear navigation between them.

Multi-Page Apps in Streamlit

Streamlit makes multi-page apps remarkably simple. Create a pages/ folder in your app directory, then add separate Python files for each page:

my_app/
├── main_page.py          # Main entry point
└── pages/
    ├── 01_data_explorer.py
    ├── 02_visualizations.py
    └── 03_settings.py

Streamlit automatically detects these files and builds a sidebar navigation menu. Each page file works like a standalone Streamlit script:

# pages/01_data_explorer.py
import streamlit as st

st.title("Data Explorer")
st.write("Explore your data here")
# Your widgets and charts

Multi-Page Apps in Dash

Dash requires more manual setup using dcc.Location and callbacks. You define routes and conditionally render content based on the URL pathname:

from dash import Dash, dcc, html, Input, Output

app = Dash(__name__)

app.layout = html.Div([
    dcc.Location(id='url', refresh=False),
    html.Div([
        dcc.Link('Home', href='/'),
        dcc.Link('Page 1', href='/page1'),
    ]),
    html.Div(id='page-content')
])

@app.callback(Output('page-content', 'children'),
              Input('url', 'pathname'))
def display_page(pathname):
    if pathname == '/page1':
        return html.Div("Page 1 content")
    return html.Div("Home content")

Key Takeaway: Multi-page dashboards organize complex applications into logical sections—Streamlit automates this with file-based routing, while Dash uses URL-based routing with callbacks for maximum control.