Priority of styleOverrides with custom theme higher than sx when using pigment-css in layout.tsx (Next.js) #43529
Labels
bug 🐛
Something doesn't work
customization: theme
Centered around the theming features
package: pigment-css
Specific to @pigment-css/*
Steps to reproduce
When using pigment-css as a replacement for @emotion/react in a Next.js project, I noticed that in the layout.tsx file, the priority of styleOverrides in a custom theme takes precedence over the sx prop styling applied directly to MUI components.
Interestingly, this issue does not occur in page.tsx, where the sx prop correctly overrides the styleOverrides in the theme.
I am not sure if this issue also occurs with @emotion/react, but it seems inconsistent and potentially problematic. The sx prop is intended for inline, component-level styling and should ideally have the highest priority.
Github repository
It behaves strangely on Codesandbox; the theme settings configured in next.config.mjs do not take effect.
Codesandbox
Current behavior
next.config.mjs
page.tsx, layout.tsx
Expected behavior
Context
No response
Your environment
npx @mui/envinfo
Search keywords: pigment-css, v6, next.js
The text was updated successfully, but these errors were encountered: