在 Material UI 中,如何覆盖选择器选择的组件样式?
In Material UI, How can I override a selector selected component style?
在MaterialUI中,为了延长MuiInputLabel
和MuiInput
之间的距离,我必须覆盖label + .MuiInput-formControl
的marginTop。
然而,createMuiTheme
的覆盖仅提供对 Mui 组件 CSS 的直接覆盖,例如:
createMuiTheme({
overrides: {
MuiInput: {
formControl: {
marginTop: '1.5rem',
},
},
}
})
我该如何做:
createMuiTheme({
overrides: {
'label+MuiInput': {
formControl: {
marginTop: '1.5rem',
},
},
}
})
谢谢...
这是相关的 JSS 文档:
这是您需要的语法:
const theme = createMuiTheme({
overrides: {
MuiInput: {
formControl: {
"label + &": {
marginTop: "1.5rem"
}
}
}
}
});
这是一个工作示例:
在MaterialUI中,为了延长MuiInputLabel
和MuiInput
之间的距离,我必须覆盖label + .MuiInput-formControl
的marginTop。
然而,createMuiTheme
的覆盖仅提供对 Mui 组件 CSS 的直接覆盖,例如:
createMuiTheme({
overrides: {
MuiInput: {
formControl: {
marginTop: '1.5rem',
},
},
}
})
我该如何做:
createMuiTheme({
overrides: {
'label+MuiInput': {
formControl: {
marginTop: '1.5rem',
},
},
}
})
谢谢...
这是相关的 JSS 文档:
这是您需要的语法:
const theme = createMuiTheme({
overrides: {
MuiInput: {
formControl: {
"label + &": {
marginTop: "1.5rem"
}
}
}
}
});
这是一个工作示例: