In Material UI, How can I override a selector selected component style?

前端 未结 1 565
没有蜡笔的小新
没有蜡笔的小新 2021-01-16 08:18

In Material UI, to extend the distance between MuiInputLabel and MuiInput, I have to override the marginTop of label + .MuiInput-formControl<

相关标签:
1条回答
  • 2021-01-16 08:23

    Here's the relevant JSS documentation:

    https://cssinjs.org/jss-plugin-nested?v=v10.0.0-alpha.10#use--to-reference-selector-of-the-parent-rule

    Here's the syntax you need:

    const theme = createMuiTheme({
      overrides: {
        MuiInput: {
          formControl: {
            "label + &": {
              marginTop: "1.5rem"
            }
          }
        }
      }
    });
    

    Here's a working example:

    0 讨论(0)
提交回复
热议问题