How to add “All” and “None” option in st.multiselect so that if I click “All” then it select all options and if I select “None” then it select no options. I will be grateful if anyone solve this problem or if the solution is already exists then kindly provide me the link.

Hi @udo ,

Here’s a list of neat workarounds, provided by @Marisa_Smith .

Does this help ?


1 Like

Thanks a lot. Also big fan of your.

1 Like

Hi @AvratanuBiswas, I need one modification in the present code. Can I add the “All” button in the top right side instead of using it in the below (which was explained in option 3)?

Hi @udo,

Yeah for sure. You just need to put the all = st.checkbox("Select all") line before calling the container.


How to shift this “Select all” option to the right in that line?

It is possible using st.coloums syntax .

col1, col2 = st.columns((2,1))
with col1:
    col1.write("Select one or more options:")
    container = st.container()
with col2:
    all = st.checkbox("Select all")

I don’t know, if it’s possible to align them horizontally . Need to play around with the column headers or widgets labels.