Align to the right

Hi,
given a widget, for example st.button, how can i align it to the right?
instead of default left

thanks

1 Like

Hi @iuiu ,

Please reference st.columns from the streamlit docs.

Cheers

Hi,
thanks for the quick answer.

I don’t a β€œhacky” way like

_,c1= st.columns([5,1])
c1.button(...)

this can create weird displays, cause is not a right align. I want proper right alignment
Something like

st.button(..., align='right')

thanks

There isn’t a way to do it within the parameters of st.button or configuration of the app. You can inject CSS to change some things, but it will definitely be hacky.

Probably the cleanest thing will be to use the stylable container from the streamlit-extras package. You can use the stylable container around your button and include right-alignment in the CSS.