Material-ui: using the theme variable inside createMuiTheme()

Created on 22 Apr 2018  路  2Comments  路  Source: mui-org/material-ui

Hi,

I would to achieve the following:

import { createMuiTheme } from "material-ui/styles";
import "typeface-roboto";

const theme = createMuiTheme({
  overrides: {
    MuiButton: { root: { margin: theme.spacing.unit * 2 } }
  }
});

export default theme;

I don't see how's that possible to use the theme variable like that (I think it can only be used via withStyles()).
Is there a way to support it?
I'm able to implement it myself and create a pull request, with some guidance.

Thanks!

question

Most helpful comment

@galah92 Something I have been doing so far:

import { createMuiTheme } from "material-ui/styles";
import "typeface-roboto";

const theme = createMuiTheme();
theme.overrides = {
  MuiButton: { root: { margin: theme.spacing.unit * 2 } }
}

export default theme;

All 2 comments

@galah92 Something I have been doing so far:

import { createMuiTheme } from "material-ui/styles";
import "typeface-roboto";

const theme = createMuiTheme();
theme.overrides = {
  MuiButton: { root: { margin: theme.spacing.unit * 2 } }
}

export default theme;

Saved my life ))

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

zabojad picture zabojad  路  3Comments

sys13 picture sys13  路  3Comments

mb-copart picture mb-copart  路  3Comments

rbozan picture rbozan  路  3Comments