import Grid2 from '@mui/material/Grid2';
// or
import { Grid2 } from '@mui/material';
Learn about the difference by reading this guide on minimizing bundle size.
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
children | node | - | The content of the component. |
columns | Array |
12 | The number of columns. |
columnSpacing | Array<number | string> | number | object | string | - | Defines the horizontal space between the type item components. It overrides the value of the spacing prop. |
container | bool | false | If true , the component will have the flex container behavior. You should be wrapping items with a container. |
direction | ‘column-reverse’ | ‘column’ | ‘row-reverse’ | ‘row’ | Array<‘column-reverse’ | ‘column’ | ‘row-reverse’ | ‘row’> | object | ‘row’ | Defines the flex-direction style property. It is applied for all screen sizes. |
offset | string | number | Array<string | number> | object | - | Defines the offset value for the type item components. |
rowSpacing | Array<number | string> | number | object | string | - | Defines the vertical space between the type item components. It overrides the value of the spacing prop. |
size | string | bool | number | Array<string | bool | number> | object | - | Defines the size of the the type item components. |
spacing | Array<number | string> | number | object | string | 0 | Defines the space between the type item components. It can only be used on a type container component. |
wrap | ‘nowrap’ | ‘wrap-reverse’ | ‘wrap’ | ‘wrap’ | Defines the flex-wrap style property. It’s applied for all screen sizes. |
The ref
is forwarded to the root element.
You can use MuiGrid2
to change the default props of this component with the theme.
These class names are useful for styling with CSS. They are applied to the component’s slots when specific states are triggered.
Class name | Rule name | Description |
---|---|---|
.MuiGrid2-container | container | Styles applied to the root element if container={true} . |
.MuiGrid2-root | root | Styles applied to the root element. |
You can override the style of the component using one of these customization options:
styleOverrides
property in a custom theme.If you did not find the information in this page, consider having a look at the implementation of the component for more detail.