Aidurber / react-picky

Yet another React multiselect. With checkbox support instead of tags.
MIT License
79 stars 35 forks source link

maxLength on filter input #226

Closed fishonweb closed 3 years ago

fishonweb commented 3 years ago

I would like to be able to limit character in filter input.

Currently, any user could type character in input filter without limit. It could be useful to use maxLength to limit it.

Aidurber commented 3 years ago

Hmm, perhaps by using the filterTermProcessor see here: https://github.com/Aidurber/react-picky#prop-descriptions

A function that takes a string and returns a string. Useful for trimming and processing a filter term before it filters the options. Default: (term) => term

Your function could be something like: (term) => term.trim().slice(0, 20)

fishonweb commented 3 years ago

Thank you ! I had tried it and I have error with react minification with Version 5. I have to fix it to valid this.

Aidurber commented 3 years ago

@fishonweb Did you figure it out?