liveBook · Manning

St.tabs

As explained in Build Python Web Apps with Streamlit

st.tabs is a Streamlit API function that creates selectable tab containers for organizing alternative content panels.

Use st.tabs to organize alternative content panels behind clickable titles. Pass a list of strings, and Streamlit creates one tab for each title. section 6.5.1

One chart per metric

A dashboard can create tabs from display_metrics: chart_tabs = st.tabs(display_metrics). Iterate through the metrics, select chart_tabs[idx], and place each metric’s Plotly line chart inside that tab with a with context manager. section 6.5.1

The basic pattern is:

  • Prepare tab titles such as ["Home", "About us", "Careers"] or a list of dashboard metrics. section 6.5.1
  • Call st.tabs with those titles and use the returned tab objects by index. section 6.5.1
  • Render the appropriate content inside each selected tab. section 6.5.1

How Build Python Web Apps with Streamlit covers it

How deep it goes
Explains titles, returned tab objects, indexed iteration, and context-managed content, without discussing widget internals.
Examples
Uses Home/About us/Careers titles and a dashboard containing one Plotly time series chart per metric.
What it assumes
Assumes basic Python iteration and with-context-manager syntax while demonstrating the Streamlit API from its usage pattern.
What you can do after
Apply it via Streamlit to build tabbed dashboards with content matched to each tab.
How it connects
Connects tab containers with Streamlit layout containers, context managers, Plotly charts, and metric configuration.

This explainer was generated by Manning's knowledge graph from the text of Build Python Web Apps with Streamlit. The section links point to the parts of the book it draws on.