REACT - MUI - Autocomplete - HelperText and Error
REACT - MUI - Autocomplete - HelperText and Error
As normal MUI Control HelperText and Error props are not available inside the AutoComplete Control. To achieve the same We have use TextField props
<Autocomplete
id="cboCountry"
options={CountryList}
getOptionLabel={(option) => option.countryName}
getOptionValue={(option) => option.id} /
value={CountrySelected}
size="small"
sx={{ width: 300 }}
renderInput={(params) => (
id="cboCountry"
options={CountryList}
getOptionLabel={(option) => option.countryName}
getOptionValue={(option) => option.id} /
value={CountrySelected}
size="small"
sx={{ width: 300 }}
renderInput={(params) => (
<TextField {...params} label="Country"
required
helperText={"Vaue is required in Country}
error={true}
/>
)}
placeholder="Country"
/>
Comments
Post a Comment