How to align button and data in different columns?

As you see, 5 lines data and button. Seems button’s size is higher than data item.

And, can I add button to tables?

code

import streamlit as st
col1, col2, col3 = st.columns(3)
for j in range(0,5):
   with col1:
       st.write("8888888888888")
   with col2:
      st.write("XXXXXXXXXXXXXX")
   with col3:
       (st.button("btn"+str(j),key="_btn"+str(j))) 

You can fix this by just creating a new st.columns for each row:

import streamlit as st
for j in range(0,5):
    col1, col2, col3 = st.columns(3)
    with col1:
        st.write("8888888888888")
    with col2:
        st.write("XXXXXXXXXXXXXX")
    with col3:
        (st.button("btn"+str(j),key="_btn"+str(j))) 

2 Likes

Thanks for help!
Btw, do you know how to add buttons or radio to st.table? Is it possible?

Nope that’s not possible. We might support that for st.dataframe in the distant future. st.table is thought to show a simple, markdown-like table without any fancy stuff.