-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[material-ui] Style separation between 2 versions of Material UI #44962
Comments
I've tried also a different approach, by using import { createTheme } from '@mui/material-v6/styles';
import { createStyled } from '@mui/system-v6';
export const theme = createTheme({
cssVariables: { cssVarPrefix: 'mui6' },
spacing: 4,
palette: {
.....
secondary: {
main: '#FF0000'
}
}
});
export const styledV6 = createStyled({ defaultTheme: theme }); Then I created a button with this import { Button } from '@mui/material-v6';
export const StyledButton = styledV6(Button)(({ theme }) => {
console.log(theme.palette.secondary.main); // Here should be color from the defaultTheme provided to createStyled, but it's still from V5 theme
return {
height: 200,
backgroundColor: theme.palette.secondary.main
};
}); Shouldn't the |
Are they in a separate page or mixing in the same page? just want to make sure that my suggestion suit your requirement the most. |
Hi @siriwatknp , They are in the same page. The best case scenario would be if, somehow, I can isolate all MUI5 components and theme from the MUI6 components and theme. With To give some context, currently our entire design system is implemented with MUI5 and a custom theme, the app is wrapped with a theme provider. On the next iteration we'll switch from theme to styled as we'll need to support multiple versions of the same component... So we can have TextField 1.0 1.1 1.2, each having some visual diffs. Creating isolated components with Eventually we'll get rid of MUI5 theme & components, but until then, we should be able to support both on same pages |
Hello,
TLDR: I need to support 2 versions of MUI, 5 & 6, in the same project. The style from MUI-5 theme provider should not apply to the MUI 6 components
Context:
In an App we have he old UI components build on top of MUI 5. We are in the phase which we want to build a new version of our design system and I wanted to create a separate, new, UI-components library based on MUI 6.
I thought that this way we can create new components without interfering with the old ones
Solution? & Implementation:
In my original plans I wanted to separate the classname creation for V6 components so in that way whatever styles are defined in the V5 theme provider should be propagated to the V6, since it should have different classNames.
V6-
prefix is added to V6 componentsThe issue that I have is that the V6 takes the theme styling from the V5 theme provider
If I try to add a
ThemeProvider
for the V6 it overrides completely the theme provider of theV5
Is there anyway to isolate changes between the 2 theme versions?
The text was updated successfully, but these errors were encountered: