Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit choices for gr.Dropdown multiselect #3184

Closed
1 task done
apolinario opened this issue Feb 12, 2023 · 5 comments · Fixed by #3211
Closed
1 task done

Limit choices for gr.Dropdown multiselect #3184

apolinario opened this issue Feb 12, 2023 · 5 comments · Fixed by #3211
Assignees
Labels
enhancement New feature or request

Comments

@apolinario
Copy link
Contributor

apolinario commented Feb 12, 2023

  • I have searched to see if a similar issue already exists.

Is your feature request related to a problem? Please describe.
I would like to limit to a certain number of choices for the multiselect option

Describe the solution you'd like
I would like to limit the user to choose only a fixed amount of options out of all, so say a maximumChoices parameter that can be set to a value and then users can only select up to that amount of options.

@apolinario
Copy link
Contributor Author

apolinario commented Feb 12, 2023

An odd additional request:
If we implement something like a maximumChoices parameter, please have it start with 1.

It know it sounds weird and would be more logical that if multiselect == True, a maximumChoices parameter should start from >=2, but this would be a way to allow for users to use the amazing searchable UI of multiselect even if they only need 1 option selected.

An alternative is a searchable param to be set to True even if multiselect is False

@abidlabs
Copy link
Member

Makes sense to me! cc @dawoodkhan82

@abidlabs abidlabs added the enhancement New feature or request label Feb 12, 2023
@freddyaboulton
Copy link
Collaborator

When we implement this, I think we should just make the "regular" Dropdown an alias for multiselect with maximum_choices=1 and that way all dropdowns will be searchable.

@abidlabs
Copy link
Member

abidlabs commented Feb 13, 2023

I like that (and agree that the regular Dropdown should be searchable) but the only issue is that the Dropdown passes in the selected value as a string, whereas if multiselect=True, the selected values are always passed in as a list

@dawoodkhan82 dawoodkhan82 self-assigned this Feb 13, 2023
@dawoodkhan82
Copy link
Collaborator

Makes sense. I'm sure I can make it so that the regular dropdown uses the Multiselect UI but still returns a string, so it won't be a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants