I've scoured every corner of the internet, but I'm still stumped by this question: How can I tweak the text color (not the background) for a selected or hovered MenuItem? I know the solution lies within useStyles, but my attempts thus far have been fruitless. I've experimented with various CSS approaches, but material-ui seems to have its own unique naming conventions.
const StyledMenuItem = withStyles(theme => ({
root: {
"&:focus": {
backgroundColor: theme.palette.primary.main,
"& .MuiListItemIcon-root, & .MuiListItemText-primary": {
color: theme.palette.common.white
}
},
paddingTop: "4px",
paddingBottom: "4px",
paddingRight: "4px",
paddingLeft: "4px",
margin: "4px",
fontSize: "0.8rem",
lineHeight: "1",
},
searchMenuItem: {
paddingTop: "2px",
paddingBottom: "2px",
selectedTextColor: "#ffffff",
}
}))(MenuItem);
Could someone please guide me on what needs to be added to useStyles in order to change the selected text of a menuitem to white?
I've attempted adding things like
&.selected: {
color: "#ffffff",
}
to the menuitem classes without success. Any assistance would be greatly appreciated!