-
-
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
Support Shadows overrides #28820
Comments
@chris97420 the material design theme expects that array will be used for the shadows, and you can add additional shadows or redefine the array itself. If you are using cc @siriwatknp this may be something to consider when developing the new design system. |
@mnajdova Thanks, me and @danilo-leal will take this into account for the new design system. |
Any updates on this issue? A very simple patch that worked for me was changing the file at export interface Shadows {
0: 'none';
1: string;
2: string;
3: string;
4: string;
5: string;
6: string;
7: string;
8: string;
9: string;
10: string;
11: string;
12: string;
13: string;
14: string;
15: string;
16: string;
17: string;
18: string;
19: string;
20: string;
21: string;
22: string;
23: string;
24: string;
};
declare const shadows: Shadows;
export default shadows; I was then able to augment the interface and extend the theme. |
We don't plan any changes to the structure at this moment. As mentioned above, you can extend it with custom values and use module augmentation to extend the type. |
I am unable to get that to work without patching the MUI module in I have tried these two methods: // Tried augmenting the type as an interface
declare module '@mui/material/styles/shadows' {
export interface Shadows {
customShadowA: string;
customShadowB: string;
};
}
// Tried augmenting the type directly
declare module '@mui/material/styles/shadows' {
export type Shadows = {
customShadowA: string;
customShadowB: string;
};
}
// Like this too
declare module '@mui/material/styles/shadows' {
export type Shadows {
customShadowA: string;
customShadowB: string;
};
} I would always get an error as such:
If I am missing the point; would please be kind to show an example of I could add custom shadows and have them typed into my theme. |
As I understand, you could only augment an Interface with TypeScript, and since Shadows is a type, there is no way to "extend" it. |
Ah, I see, ok looks like the limitation exists. I guess we should look into this in v6, any change now I think will be a breaking change, but I may be wrong. I will leave it open in case someone wants to explore it further. |
The patch works fine, changing it from Type to Interface does nothing since no Type specific features are used anywhere. But what do I know. If any maintainers could look into this it should be a very simple fix. |
@theHasanas would you like to create a PR with the change? If the CI is green I think it should be safe to merge it. |
Ahh, I looked again and you were right, it would indeed introduce a breaking change; the patch is modifying While MUI itself doesn't really rely on the Sorry for the confusion. Will just stick to the patch and hope for v6. |
Thanks for looking into it @theHasanas I've added it to our v6 internal project :) |
Summary 💡
Shadows should be configurable and extensible the same way as the colour palette
Examples 🌈
Motivation 🔦
Make MUI a more customizable extensible UI framework
The text was updated successfully, but these errors were encountered: