How do I add a Component to the sidebar?

You can add a component to st.sidebar using the with syntax. For example:

with st.sidebar:

In fact, you can add your component to any layout container (eg st.columns, st.expander), using the with syntax!

col1, col2 = st.columns(2)
with col2:

Still have questions?

Our forums are full of helpful information and Streamlit experts.

Was this page helpful?

editEdit this page on GitHub