Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Streamlit how to display buttons in a single line

Hi all I am building a simple web app with streamlit in python. I need to add 3 buttons but they must be on the same line.

Obviously the following code puts them on three different lines

st.button('Button 1')
st.button('Button 2')
st.button('Button 3')

Do you have any tips?

like image 326
Wing Avatar asked Nov 25 '25 18:11

Wing


1 Answers

Apparently this should do it

col1, col2, col3 = st.columns([1,1,1])

with col1:
    st.button('1')
with col2:
    st.button('2')
with col3:
    st.button('3')
like image 179
Wing Avatar answered Nov 27 '25 07:11

Wing



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!