Material-ui: Question: Way to set the default spacing of the new 1.1 Grid

Created on 1 Jun 2018  路  6Comments  路  Source: mui-org/material-ui


Question: We are upgrading to MUI 1.1. and the default spacing of 16 for the Grid is gone with (#10768) which is alright but is there a way to override the spacing in the theme overrides so we don't need to change in so many places?

  • [X] This is a v1.x issue (v0.x is no longer maintained).
  • [X] I have searched the issues of this repository and believe that this is not a duplicate.
Grid question

All 6 comments

@fondberg The default spacing is 0.

capture d ecran 2018-06-01 a 13 51 49

I know it is @oliviertassinari but the question was how to override it for the component.

@fondberg Oh, I have overlooked the question. I would encourage you to write a wrapping Grid component with your default value. Alternatively, you can use the props key in the theme.
https://material-ui.com/customization/themes/#properties

const theme = createMuiTheme({
  props: {
    // Name of the component 鈿涳笍
    MuiGrid: {
      // The properties to apply
      spacing: 8,
    },
  },
});

thanks!

I tried it and it doesn't work. Might go back to using a wrapper.
Error is: Warning: Failed prop type: The propertyspacingofGridmust be used oncontainer.

I tried it and it doesn't work.

@fondberg It's working. I'm taking care of the prop-type warning in: #11688.

Was this page helpful?
0 / 5 - 0 ratings