rkit / react-select2-wrapper

Wrapper for Select2
MIT License
163 stars 97 forks source link

Limiting the number of selections (ex: maximumSelectionLength=2) #44

Closed khoandse closed 8 years ago

khoandse commented 8 years ago

Is there any way to pass option "maximumSelectionLength" into the component?

Select2's way: select2.github.io/examples.html#multiple-max

I tried your way: https://github.com/rkit/react-select2-wrapper#properties But it didn't work.

rkit commented 8 years ago

You should use options. Example:

<Select2
  multiple
  data={['bug', 'feature', 'documents', 'discussion']}
  options={
    {
      maximumSelectionLength: 2,
      placeholder: 'search by tags',
    }
}
/>