I'm looking at this example of Autocomplete provided by MaterialUI
https://codesandbox.io/s/81qc1
I was wondering how I can display a "No options found" message if no results are found.
I'm looking at this example of Autocomplete provided by MaterialUI
https://codesandbox.io/s/81qc1
I was wondering how I can display a "No options found" message if no results are found.
Use props noOptionsText for Material-UI Autocomplete
Text to display when there are no options. For localization purposes, you can use the provided translations.
import Autocomplete from '@material-ui/lab/Autocomplete';
<Autocomplete
noOptionsText={'Your Customized No Options Text'}
...
/>
For those who don't want "No options" to show up at all,
<Autocomplete
freeSolo={true}
/>
you can use noOption :
<Asynchronous
noOption={ <div className="d-flex align-items-center justify-content-between mt-2">
<span className="fw-bold">User not found?</span>
<Button variant="text" color="primary" type="button" startIcon={<AddIc fontSize="small"/>} onClick={()=>setOpenModal(true)}>Add
User</Button>
</div>}
/>