score:0

I was not using styled-components, but for MUI + CSS Modules with Storybook v6 the following configuration made it so MUI styles were not overriding our own styles.

.storybook/preview.js:

import { StylesProvider } from '@material-ui/styles'

export const decorators = [
  (Story) => (
    <StylesProvider injectFirst>
      {Story()}
    </StylesProvider>
  ),
]

We had exiting config for parameters in that file from another add-on and I just put the above code in there with it no problem. You may also need to import React in there too depending on how you have things setup (we did not).


Related Query

More Query from same tag