I am trying to use the st.multiselect widget in Streamlit to allow users to select job titles from a predefined list. However, I also want to provide an option for users to input a custom job title if it’s not available in the list.
# Assuming 'job_titles' is your list of job titles
selected_job_titles = st.multiselect(
label="Job Titles",
options=job_titles,
default=None,
placeholder="Choose an option",
)
Is there a way to achieve this functionality directly within st.multiselect or is there a recommended workaround for allowing custom input alongside predefined options?
I appreciate any insights or suggestions you can provide. Thank you!
First of all, I’m a big fan of your work and YouTube videos; they’ve been incredibly helpful to me.
Regarding the solution provided earlier, it seems that the user would initially search within the multiselect options. If they don’t find a match, they can then proceed to add a new element. However, this approach splits the input process into two steps. My goal is to streamline the process into a single step, if possible. I hope I’ve clarified my requirements.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.