Material-ui: [AutoComplete] 'case' option

Created on 6 Dec 2015  路  8Comments  路  Source: mui-org/material-ui

Is there a way or are there plans to add a 'case' prop to AutoComplete so that searches can be either case-sensitive or case-insensitive?

Autocomplete enhancement

Most helpful comment

Just in case anyone else needs this in the mean time:

filter: function filter(searchText, key) {
  return key.toLowerCase().includes(searchText.toLowerCase());
}

All 8 comments

I think this is a good feature to have. And trivial to implement. @yongxu @oliviertassinari Thoughts?

FYI - I haven't tested this but I'm pretty sure the filter function is overridable. If you pass a prop <AutoComplete filter={yourCustomFilterImplementation} /> it should work.

@newoga I think this is a very common usage and should be directly supported by the library to keep it simple. But that's a good workaround for now, :+1: :+1:

And it does seem to work @newoga, so thanks! It is a bit verbose as opposed to small property flag value though, so the addition will still be a welcome one.

Just in case anyone else needs this in the mean time:

filter: function filter(searchText, key) {
  return key.toLowerCase().includes(searchText.toLowerCase());
}

@genyded Thanks lot for providing this. We'll make sure to add this feature as soon as possible.

added this feature, not sure if this is the best way to do it though. #2755

Closed by #4783

Was this page helpful?
0 / 5 - 0 ratings