Streamlit Side Bar

Learn to organize the application’s appearance.

Declutter the application

Widgets used for input can clutter the application page. We may want the application to show only certain information to users based on their selections but not have the actual selection or input widgets.

This is where the sidebar option is useful.

Appending it to any widget ensures that the specific widget will be displayed on the sidebar. This can then be expanded and collapsed as desired.

Execute the example

Let’s run the code below that shows how to use st.sidebar() to declutter our application:

Get hands-on with 1200+ tech skills courses.