In Material UI, to extend the distance between MuiInputLabel
and MuiInput
, I have to override the marginTop of label + .MuiInput-formControl
.
However, createMuiTheme
's override only provide direct override of a Mui Component CSS, such as:
createMuiTheme({
overrides: {
MuiInput: {
formControl: {
marginTop: '1.5rem',
},
},
}
})
How can I do something like:
createMuiTheme({
overrides: {
'label+MuiInput': {
formControl: {
marginTop: '1.5rem',
},
},
}
})
Thanks...
Here's the relevant JSS documentation:
Here's the syntax you need:
const theme = createMuiTheme({
overrides: {
MuiInput: {
formControl: {
"label + &": {
marginTop: "1.5rem"
}
}
}
}
});
Here's a working example:
来源:https://stackoverflow.com/questions/54724968/in-material-ui-how-can-i-override-a-selector-selected-component-style