You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
I was trying to figure out how to limit the number of selections in the multiselect option. For example: if my total number of options are 6, but the user should not select more than 3.
The text was updated successfully, but these errors were encountered:
Hi @karankumar89
You can prevent the selection of additional items in the onChange callback. Just don't update your state if the length is greater than a certain amount:
https://codesandbox.io/s/5wmqw8m24n
There is a little weirdness, if you look at the above link the value that is console logged doesn't reflect the number of items selected. This is because the component maintains its own internal state. However, you should still be able to do this, just use your own state as your single source of truth.
I was trying to figure out how to limit the number of selections in the multiselect option. For example: if my total number of options are 6, but the user should not select more than 3.
The text was updated successfully, but these errors were encountered: