React-select: [V2] [Feature Request] Ability to specify the minimum length for performing a search

Created on 19 Jul 2018  路  3Comments  路  Source: JedWatson/react-select

Looking for the ability to prevent the "search" option from occurring until you type in a specific number of characters.

I'm basically looking for the feature that already exists on React-Bootstrap-Typeahead:
https://ericgio.github.io/react-bootstrap-typeahead/#behaviors
minLength: Require minimum input before showing results

Most helpful comment

Like, really? Is this the true way of setting minimum input length? This looks too dirty for such a simple thing, and I cannot even imagine why not have this out of the box

All 3 comments

you can do that manually in loadOptions no ? check the length of the query if less than expected return an empty promise

Ah, didn't see that. Will use that in future; I've encountered similar components that do this strangely, though, and if you did something like input.value.length > 3, it updates strangely, because in those components, the input.value state (or what have you) is updated after the check, not before.

Thoughts on this would be appreciated.

Like, really? Is this the true way of setting minimum input length? This looks too dirty for such a simple thing, and I cannot even imagine why not have this out of the box

Was this page helpful?
0 / 5 - 0 ratings