Max selection for MultiSelect component

1 Answer 105 Views
MultiSelect
Jenn
Top achievements
Rank 1
Jenn asked on 10 Jan 2022, 11:53 PM
Is there something like a maxSelectedItems for the MultiSelect component?

We're trying limit the number of items that can be selected. Wondering if there's an existing attribute, or if we have to create something ourselves.

1 Answer, 1 is accepted

Sort by
1
Accepted
Stefan
Telerik team
answered on 11 Jan 2022, 05:38 AM

Hello,

We can do this inside on onChange event of the component. We can check for the length of the new value and only update the state if it is under a specific number:

https://stackblitz.com/edit/react-utddxd?file=app/main.jsx

Regards,
Stefan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
MultiSelect
Asked by
Jenn
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or