Drop down menu

Is it possible to create a drop-down menu instead of radio buttons? If not directly, is there any other method to create a drop-down menu, as I have 40 options and its not possible to include them using radio buttons.

3 Likes

Hello @rutvik

You can use st.selectbox() for your purpose. I suggest you take a look at Streamlit’s API reference. They have listed all the components you can use, and how to use them.

Here’s an example on how to use selectbox, taken from Streamlit’s documentation:

>>> option = st.selectbox(
...     'How would you like to be contacted?',
...     ('Email', 'Home phone', 'Mobile phone'))
>>>
>>> st.write('You selected:', option)
7 Likes

Ohh yes, I was unable to interpret it properly. Anyways…Thanks a lot!!