Hi, this is an feature request to add an option to restrict searchable to only match the prefix of labels and values. For instance, I want to implement state selector for US states as shown in demo site http://jedwatson.github.io/react-select/ but restrict the search to only match prefix.
Currently, searchable option matches any substring, so if user enters "NO" to enter North Dakota, react-select also shows Illinois. Similarly, when user enter ND (as abbreviation of North Dakota), react-select shows Indiana.


For this type of input, we expect user to enter from the first character so it'd be great if react-select support an option to restrict search to only match prefix of words.
Hi @daisy1754 we do have a matchPos prop that you can set. If you set it to start it will only check the start of the string. Also if you would like to customize this you can pass in your own filterOptions prop. See docs for more info: https://github.com/JedWatson/react-select#advanced-filters. Does this work for you?
Ah, this is exactly what I wanted. I don't know why I look over this.. Thanks @agirton !
Most helpful comment
Hi @daisy1754 we do have a
matchPosprop that you can set. If you set it tostartit will only check the start of the string. Also if you would like to customize this you can pass in your ownfilterOptionsprop. See docs for more info: https://github.com/JedWatson/react-select#advanced-filters. Does this work for you?