reactjsmaterial-uistorybookmakestyles

set with and height on makeStyles theme material-ui


const useStyles = makeStyles(
  (theme) => ({
    iconContainer: {
      margin: theme.spacing(0, 4, 0, 0),
      [theme.breakpoints.up('md')]: {
        margin: theme.spacing(-1, 5, 0, -1),
      },
    },

   <Grid item className={classes.iconContainer}>
          {icon}
        </Grid>

Gestion:

How to via theme to set with and height of class iconContainer


Solution

  • You can simply add height/width to useStyles object.

    iconContainer: {
       width: 100, // px, you can use other units as well '40em', '40rem', '40%', etc... 
       height: 50, 
    }