Narrow selectbox with st 1.54
Narrow selectbox with st 1.55
Hey all,
I am experiencing an issue with the width of the dropdown menu when clicking on a st.selectbox. Until version 1.54 the menu adjusted to the width of the dropdown content (s. top example), even when the selectbox widget was quite narrow as in the example.
From 1.55 I now seemingly cannot vary the selectbox width without affecting the dropdown menu.
My question: Is this intended, or am I just missing how to set it independely of the widget width?
Thank you all!
Jonathan
Hey Jonathan, thanks for bringing this up and welcome to the community!
You’re not alone—others have noticed this change too. In Streamlit versions up to 1.54, the dropdown menu for st.selectbox would auto-size to fit its content, even if the selectbox itself was narrow. Starting with 1.55, the dropdown menu width is now tied to the selectbox widget’s width, so you can’t set them independently anymore. This is an intentional UI update for consistency and accessibility, and there’s currently no built-in parameter to decouple the dropdown width from the selectbox width.
If you need a workaround, you can try custom CSS hacks, but be aware these aren’t officially supported and may break with future updates. For more details, see the st.selectbox documentation and related community discussions. If you want this feature back, consider opening a feature request on the Streamlit GitHub!
Sources: