-
-
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
Document overrides feature from jss-theme-reactor #6687
Comments
Thanks oleg,
import React from 'react';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import {createMuiTheme} from 'material-ui/styles/theme'
import Button from 'material-ui/Button';
const muiTheme = createMuiTheme({
overrides:{
MuiButton:{
root:{
fontSize: 20,
}
}
}
});
class Main extends React.Component {
render() {
// MuiThemeProvider takes the theme as a property and passed it down the hierarchy
// using React's context feature.
return (
<MuiThemeProvider muiTheme={muiTheme}>
<Button raised>Default</Button>
</MuiThemeProvider>
);
}
}
export default Main; |
Yes, sounds right. |
@sxn You might want to have a look at the issue. Any progress with the documentation of the theme/style/overrides since we talked about it? |
If anybody wants to customize Material UI beyond the official recommendation this gist contains a couple of hacks that might help. Unlike using the import { merge } from 'lodash'
const muiStylesheetOverrides = {
MuiFormLabel: (originalStyles, theme) => merge(originalStyles, {
error: {
color: theme.palette.text.primary
},
focused: {
color: theme.palette.text.primary
}
}),
} The second hack will configure jss-theme-reactor to exclude hash postfixes from Material UI stylesheet class names. const someComponentJss = {
root: {
// This will override styles of all material-ui's <Text /> components
// under `.root`
'& .MuiText-text': {
color: 'white'
}
}
} You can use one or the other or both. |
cc @nathanmarks That could interest you. |
Hi, I have been recently asked how to do that, we should document this feature.
Here is an example from my codebase:
The text was updated successfully, but these errors were encountered: