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
Elevation shadow customization through custom theme #8289
Comments
You can always tweak the theme object after calling |
I'm trying to create red shadow beneath AppBar
But shadow style remains the same as it is by default. |
I have just tried, the following work as expected: import React from 'react';
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
import Paper from 'material-ui/Paper';
const theme = createMuiTheme();
theme.shadows[24] = theme.shadows[4];
function Shadows() {
return (
<MuiThemeProvider theme={theme}>
<Paper elevation={24}>24</Paper>
</MuiThemeProvider>
);
}
export default Shadows; |
Just met this when trying to set only one entry of the shadows array. The write-after-createMuiTheme solution works just fine, however it's not a perfect one. I'm wondering whether Not sure whether this should be a new issue, thx for your attention. |
@std4453 You can do the customization on the theme returned by |
Hi you can customize any of shadow using ES6 spread operator.
|
@maqsood1ahmed brilliant. Thank you so much! |
I want to tweak CSS shadows for particular elevation levels.
In theming guide there is
shadows
array property of themeobject
which holds style sets for all 24 elevation levels. But if I want to change any of them, as I understand, I have to provide full array of 24 elements. It would be great to somehow avoid using complete set of shadows and use only custom properties:e.g. custom shadow for
elevation = 24
theme = { shadows: { 24: '10px 10px rgba(0,0,0,0.2)' } }
But the problem is even when I copy-paste
shadows
array from Material-UI and replace some values there it doesn't affect elevation decoration of components. They still use default values from the library.Am I doing something wrong? Or is there any way to change default shadows for different elevation values?
The text was updated successfully, but these errors were encountered: