Aditya Patel Aditya Patel - 1 month ago 23x
Javascript Question

Material-UI: Uncaught TypeError: getMuiTheme is not a function

I have recently updated my material-ui to version 0.15.4 and trying to make it work. The error i am getting is that getMuiTheme is not a function, even though the folder location contains the relvant js file, also i checked and updated my react to 15.3.1,so hopefully it's not a dependency issue. But i can't seem to figure out what could be the issue.

Here is the code sample:

var React = require('react'),
mui = require('material-ui'),
getMuiTheme = require('material-ui/styles/getMuiTheme'),
LoginDialog = require('./login-dialog.jsx'),
RaisedButton = mui.RaisedButton,
MuiThemeProvider = require('material-ui/styles/MuiThemeProvider'),
darkBaseTheme = require('material-ui/styles/baseThemes/darkBaseTheme');

var Index = React.createClass({

getChildContext: function() {
return {
muiTheme: getMuiTheme(darkBaseTheme),

childContextTypes: {
muiTheme: React.PropTypes.object
render: function() {
return (
<div className="mui-app-canvas home-page-background">
onTouchTap={ this._handleLoginDialog }
linkButton={ false } />
loginUrl={ this.props.loginUrl } />

_handleLoginDialog: function() {;

module.exports = Index;


The problem is that material-ui/styles/getMuiTheme.js is transpiled from an ES2015 source, and the function you want is exported as a default.

If you want to reference this function with require(), you need to use the default property:

getMuiTheme = require('material-ui/styles/getMuiTheme').default