carbon-components-angular
carbon-components-angular copied to clipboard
Set max choose count for multi-dropdown
Detailed description
Is this a feature request (new component, new icon), a bug, or a general issue?
It's a feature. like this example react implements
Is this issue related to a specific component?
Dropdown
What did you expect to happen? What happened instead? What would you like to see changed?
set a props, like maxChooseCount. or some other way can implement this.
What version of the Carbon Design System are you using?
V4.57.6
Thank you very much!
Currently, this feature isn't supported out of the box in the official drop down designs do not support this feature in Carbon v10 or v11.
The click events are propagated to the component with the drop down. So if the user has selected 3 items in the list, than the (selected) event will return the three items.
- When the selected items reach the limit (3 for example), iterate through the items passed into the drop down & set the disabled property to true for ALL the non-selected items.
- If a user unchecks one of the selected properties, iterate through the list & set disabled property to false.
This sort of feature isn't a good idea in very long lists (thousands), hence why it hasn't been added? We would have to update all of the items in the list manually, whether we would offer this out of the box or you implement this using the steps above.
Now if you still think this feature should be available out of the box, you will need to make this feature request in carbon-design-system/carbon repository & they have to implement it before we provide this feature in Angular.
OK, thank you for your feedback. I will try to open a feature request on https://github.com/carbon-design-system/carbon.