Home > Net >  Spacing math with theme.spacing() in Material-UI v5
Spacing math with theme.spacing() in Material-UI v5

Time:09-25

In Material-UI v4, I had bits like this in my JSS classes

paddingTop: theme.mixins.toolbar.minHeight   theme.spacing(1)

In v5 however, theme.spacing() returns a string instead of a number. So the above statement would set paddingTop to 568px, which is 56 '8px' So what is now the proper way to do math with spacing?

CodePudding user response:

`calc(${theme.mixins.toolbar.minHeight}   ${theme.spacing(1)})`

CodePudding user response:

MUI Theme is just an Codesandbox Demo

  • Related