I am trying to use MUI's styleOverrides to globally apply styles to a component that was built using styled-components, but from another package. So for example, the component is built like:
const SectionTitle = styled(Box, {
name: 'SectionTitle',
slot: 'Root',
})<WizardSectionTitleProps>(({ width }) => ({
width: width || 'auto',
margin: 0,
}));
In the HTML, the class looks like:
MuiBox-root css-d4531u-SectionTitle-root
I want to be able to use styleOverrides, like:
const theme = createTheme({
palette: ...,
components: {
SectionTitle: {
styleOverrides: {
root: {
width: '100px',
}
}
}
}
});
As far as I can tell from MUI's global overrides, this should work. Also I am able to use it with MUI components, just not custom ones I build using styled-components. The styles are not applied from the styleOverrides. Any ideas why?