-
-
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
[docs][Alert] Missing root slot for style customization #44819
Comments
We are consolidating the slots and slotProps API right now, so we will look into this. @siriwatknp can likely provide more info/timeline on when this would be available. |
For Alert, the Paper is used as the root slot so you should target MuiAlert: {
defaultProps: {
variant: 'overlay', // Apply the overlay variant directly to the paper slot
},
styleOverrides: {
root: {
variants: [
{ props: { variant: 'overlay', style: { … } } },
]
}
},
} |
I marked this as docs improvement. |
Thank you for the message and the suggestion. Unfortunately, it doesn't help in my case yet. |
Based on your provide code, it should work. What else missing? please explain in more details. |
Summary
Currently, the
MuiAlert
component does not support thepaper
slot for direct styling customization int the theme file. Other MUI components, such asMuiAutocomplete
, use theslotProps
API to allow passing specific props to subcomponents likepaper
. Adding support for this inMuiAlert
would simplify the application of customPaper
variants and other styles directly to the alert’s underlyingPaper
element.Examples
Motivation
styleOverrides
to apply specific styles such as customPaper
variants. Introducing thepaper
slot would allow this styling to be applied more easily through theslotProps
API, similar to other components likeMuiAutocomplete
. This would streamline styling customization and reduce the need for manual overrides.MuiAutocomplete
, support theslotProps
API to customize internal elements (e.g.,paper
). Adding this capability toMuiAlert
would align the API across different MUI components, enhancing consistency and developer experience.paper
element (e.g.,variant
: 'overlay'), this approach reduces the need for duplicate code and manual style overrides, making the codebase easier to maintain and less prone to errors.Search keywords: alert, slot, defaultProps, paper variant
The text was updated successfully, but these errors were encountered: