-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
Migrating CSS variables in mui/material version 5 to using the OOB way of CSS variables in version 6 #44251
Comments
Generally, the best practice is just to follow the docs 😅 :
|
Sorry there's a lot of other stuff in your stackblitz, would you mind making a minimal repro? (here are some tips) @noobDev31 |
Do you think the above is a bit more minimal than before? (Please read the comment on line 21 to 24 of coreAutocomplete.ts) Do you think i should create my own definition of Theme but I am not sure how that is possible with the module augmentation logic for different special colors that MUI recommends. That's why i specifically asked about the theme css variables because that's what is causing me like more than 100 errors in a lot of components. if you have any further questions feel free to ask about the code above 😄 |
OK I don't think this is an issue with Material UI, but my opinionated take is that this whole Per your comment here, this is not a good way to fix it, but if you go down this route I don't see how it can be avoided // so basically here if I do
// let backgroundColor = `${
// (theme.palette?.[DSMConfig.autocompleteSelectedColor as keyof Palette] as PaletteColor)?.main
// }`;
// this fixes the below issue but its not a good way to fix it.
let backgroundColor = `${
theme.palette?.[DSMConfig.autocompleteSelectedColor]?.main
}`; |
👋 Thanks for using this project! We use GitHub issues exclusively as a bug and feature requests tracker, however, this issue appears to be a support request. For support with Material UI please check out https://mui.com/material-ui/getting-started/support/. Thanks! If you have a question on Stack Overflow, you are welcome to link to it here, it might help others. |
What's the problem?
I am trying to migrate our way of doing css variables with theme in V5 to use the newer way of CSS variables in V6.
I am having the following themeProvider config which uses the css variables how can i utilises the new css theme variable flag to maintain my functionality
https://stackblitz.com/edit/react-sbuu88?file=ThemeProvider.tsx,Demo.tsx,ThemeProvider.config.ts,coreBadge.ts,coreAlert.ts,coreAutocomplete.ts,dsmConfig.ts,coreAppBar.ts,tsconfig.json,index.html
What are the requirements?
Want to use the best practises on the Material UI V6 for utilizing the css theme variables
What are our options?
No response
Proposed solution
No response
Resources and benchmarks
No response
Search keywords:
The text was updated successfully, but these errors were encountered: