我正在从 Material-ui 4 迁移到 mui 5,并且我想在主题覆盖中覆盖 MuiInputLabel。
这就是我已经做过的事情:
'MuiInputLabel': {
'styleOverrides': {
'marginDense': {
'lineHeight': '1.5px',
'fontSize': typography.caption.fontSize,
},
'outlined': {
'transform': 'translate(1.4rem, 0.9rem) scale(1)',
'&.marginDense': {
'&.shrink': {
'transform': 'translate(15px, 0px) scale(1.05)',
'fontSize': '11px !important',
},
},
},
}}
Run Code Online (Sandbox Code Playgroud)
我尝试更改道具的名称,但有些东西关闭了,尽管正在应用根样式,但概述的对象的transform属性是我想要应用的。
在当前场景中,outlined和marginDense没有被应用,但如果我将它们放在defaultProps对象中MuiInputLabel-outlined,类就会出现在 DOM 中,但我在浏览器中看不到它的样式。