cssreactjsmaterial-uioverriding

react material-ui how to override muibox-root


I want to override the MuiBox-root style for the whole application.According to the official documentation I need to identify the class:

enter image description here

And among other things I can override it:

enter image description here

But if I proceed this way, it just removes the styling. What am I doing wrong here?


Solution

  • This will do:

    import { withStyles } from "@material-ui/core/styles";
    
    const styles = {
      root: {
        padding: "10px"
      }
    };
    
    function App({ classes }) {
      return <yourelement  className={classes.root}>xyz...<yourelement/>;
    }
    export default withStyles(styles)(App);