I've migrated two MUI-powered UIs vom MUI v4 to v5, which both have their body fontSize overriden, as explained in the MUI migration guide: this is to keep the v4 design decision to default to Typography body2 font size. This works as expected.
Now I would like to also ensure proper MUI v4 font size default in my Styleguidist component style guide. I've created a MuiThemeWrapper
and wired up in styleguide.config.js
:
styleguideComponents: {
Wrapper: path.join(__dirname, 'styleguidist/MuiThemeWrapper.tsx')
},
The wrapper basically does this:
const appTheme = createTheme(
{
components: {
MuiCssBaseline: {
styleOverrides: {
body: {
fontSize: '0.875rem', // ...go back to typography body2 font size as in MUI v4.
lineHeight: 1.43,
letterSpacing: '0.01071em',
},
},
},
},
palette: {
mode: 'light',
primary: { main: '#009999' },
secondary: { main: '#ffc400' },
},
})
return (
<ThemeProvider theme={appTheme}>
<ScopedCssBaseline>
{children}
</ScopedCssBaseline>
</ThemeProvider>
);
However, this does not set the expected font size to 14px, but instead to 16px. What am I doing wrong, is the body styleOverride in this case even correct?