Reputation: 14054
As you can see from the image above, the background color of the dropdown needs to be changed. I'd like to change the white to black.
Here's my code:
const styles={
textField:{
'& .MuiPopover-paper':{
backgroundColor: 'black'
}
}
}
...
<TextField select id='version' label='Version' variant='outlined' sx={styles.textField}>
<MenuItem value={10}>1</MenuItem>
<MenuItem value={20}>2</MenuItem>
<MenuItem value={30}>3</MenuItem>
</TextField>
I have tried many variations of '.MuiPopover-paper'
none seem to work.
Upvotes: 0
Views: 781
Reputation: 3350
If you want to style the underlying menu you can pass in SelectProps
to the TextField
.
<TextField
select
id="version"
label="Version"
variant="outlined"
SelectProps={{
MenuProps: {
sx: styles.textField,
},
}}
>
I changed the styles object accordingly:
const styles = {
textField: {
".MuiList-root": {
backgroundColor: "lightblue",
},
},
};
Upvotes: 1