How to limit the selectable options in Multiselect in React

1 Answer 63 Views
MultiSelect
Alexander
Top achievements
Rank 1
Alexander asked on 02 Mar 2022, 09:33 AM
Hello,

I'm currently trying out the Kendo React Framework. I use the MultiSelect component with for example
10 options. Now I want the user to only be able to have a maximum of 5 options selected at a time.
Is there a built-in way to limit the number of options that can be selected? Unfortunately, I couldn't 
find anything about this in the documentation.

I would be very happy about an answer. Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 02 Mar 2022, 09:41 AM

Hello,

That can be done by checking the length of the selected items and not updating them if they are more than X. I made an example to showcase that:

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

I hope that is helpful.

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.

Alexander
Top achievements
Rank 1
commented on 02 Mar 2022, 10:05 AM

Thank you very much for the effort. This works perfectly for me.
Tags
MultiSelect
Asked by
Alexander
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or