-
-
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] Custom Theme Not Working with v6 and Pigment CSS in Next.js #43501
Comments
It doesn't work without My case: createTheme({
// ...
components: {
MuiTypography: {
defaultProps: {
variantMapping: {
title: "h1",
title_2: "h2",
title_3: "h3",
bodyLarge: "p",
bodySmall: "p",
bodyCompact: "p",
bodyMedium: "p",
bodyRegular: "p",
bodySemiBold: "p",
link: "a",
preTitleSemiBold: "p",
preTitleBold: "p",
},
},
},
// ...
}
// ...
}); <Typography variant="bodyRegular">Loading...</Typography> Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used
See more info here: https://nextjs.org/docs/messages/react-hydration-error
+ <p
+ className="MuiTypography-root MuiTypography-bodyRegular mui-183ynif-MuiTypography-root"
+ style={{}}
+ >
- <span className="MuiTypography-root MuiTypography-bodyRegular mui-183ynif-MuiTypography-root"> MUI is rendering
... which results from not respecting PS: I'm not 100% sure if this is the same issue or a different but related one. |
Hey @wh5938316, thanks for the report! The first thing that comes to mind is asking if you added this line to your +import '@mui/material-pigment-css/styles.css'; If that doesn't fix it, could you provide a reproduction? This will help check if the configuration is correct. It would be perfect if you could share your project in a GitHub repo. Thank you! @arklanq-patronus, this seems like a different issue. May I ask you to create a separate one so it's easier to track? Thanks! |
@DiegoAndai I’ve created a reproduction of an issue I’m encountering in my project and uploaded it to CodeSandbox. The button in the example is expected to be black, but it isn’t. I’m not sure if this is a mistake in how I’m using MUI or if it’s a bug in the library. Here is the link to the reproduction: CodeSandbox Link |
@arklanq-patronus Please provide the full page that you are rendering. It could be that the I am quite sure that it's not related to Pigment CSS. |
@DiegoAndai The root cause is that the component is still using Emotion. Need to release mui/pigment-css#216 |
Please update either |
@DiegoAndai @siriwatknp Thank you for all your hard work in maintaining this project!
Please let me know if you would like me to open a separate issue for this. |
|
@wh5938316 please open a new issue regarding #43501 (comment) so it's easier to track 😊 I'm closing this one as the original issue was fixed in mui/pigment-css#216 |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note We value your feedback @wh5938316! How was your experience with our support team? |
✅ Solution
Update Pigment CSS plugin to at least
0.0.21
:Next.js
Vite
Steps to reproduce
next.config.mjs
The custom theme is not being applied as expected. Components do not reflect the customized theme settings.
Current behavior
No response
Expected behavior
No response
Context
No response
Your environment
npx @mui/envinfo
Search keywords: pigment-css, next.js, v6
The text was updated successfully, but these errors were encountered: