Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autocomplete Case Sensitive

Is there a way for the Material UI Autocomplete react component to not be case sensitive?

For example, if I have a list item "Movies" I want to be able to search "movies", "MOVIES", "Movies", etc. and have it come up regardless of what letters are capitalized in the search.

like image 945
Briar Avatar asked Mar 24 '26 11:03

Briar


1 Answers

This should do the trick. ignoreCase defaults to true. Lowercase everything.

import { createFilterOptions } from '@material-ui/lab/Autocomplete';

const filterOptions = createFilterOptions({
  ignoreCase: true,
});

<Autocomplete filterOptions={filterOptions} />

For more information, check out Custom filter.

like image 113
Adil Ahmed Avatar answered Mar 26 '26 01:03

Adil Ahmed