Disable "Clear all" in st.selectbox and st.multiselect

Hello guys,
I am currently experimenting with Altair charts and I am passing arguments from a selectbox or multiselect to the Altair script.
However, when the value is empty, it results in an error.
I am looking for a way to prevent the “clear all” option in Streamlit’s st.selectbox or st.multiselect, so that the user cannot clear the selected value and cause an error.
Thank you

Even if you remove the clear all button, a user might be able to remove options one by one and still end up with an empty selection. It would be better to check for an empty selection and handle the case accordingly. (e.g. if none, replace value will all) You could either set the widget to reset to its default value or you could just overwrite the output of the widget that you are using.

I understand now, thank you mathcatsand

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.