I have tried several strategies to change the color of the select component of material UI, but unfortunately none of them work. I define the useStyles
function, where I define a select class with the border value:
const useStyles = makeStyles(theme => ({
formControl: {
margin: theme.spacing(1),
minWidth: 120,
width: '100%',
margin: 0,
marginBottom: 15,
borderColor: 'orange'
},
selectEmpty: {
marginTop: theme.spacing(2),
},
select: {
'&:before': {
borderColor: 'red',
}
},
}))
And here is the select component:
const MaterialSelect = ({
labelText,
menuItems,
setFormValue,
initValue,
providerKey
}) => {
const classes = useStyles();
And the select:
<Select
labelId="demo-simple-select-outlined-label"
id="demo-simple-select-outlined"
value={value}
onChange={handleChange}
labelWidth={labelWidth}
className={classes.select}
input={<Input classes={{
underline: classes.underline
}}
name="age" id="age-helper" />}
>
{menuItems.map(({value, text}) => (
<MenuItem value={value}>{text}</MenuItem>
))}
</Select>