Grid API
API reference docs for the React Grid component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import Grid from '@mui/system/Grid';
// or
import { Grid } from '@mui/system';
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<number> | number | object | 12 | The number of columns. |
columnSpacing | Array<number | string> | number | object | string | - | Defines the horizontal space between the type |
container | bool | false | If |
direction | 'column-reverse' | 'column' | 'row-reverse' | 'row' | Array<'column-reverse' | 'column' | 'row-reverse' | 'row'> | object | 'row' | Defines the |
offset | string | number | Array<string | number> | object | - | Defines the offset value for the type |
rowSpacing | Array<number | string> | number | object | string | - | Defines the vertical space between the type |
size | string | bool | number | Array<string | bool | number> | object | - | Defines the size of the the type |
spacing | Array<number | string> | number | object | string | 0 | Defines the space between the type |
wrap | 'nowrap' | 'wrap-reverse' | 'wrap' | 'wrap' | Defines the |
system
properties. You can use them as props directly on the component.ref
is forwarded to the root element.Theme default props
You can use MuiGrid
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 |
---|---|---|
.MuiGrid-container | container | Styles applied to the root element if container={true} . |
.MuiGrid-direction-xs-column | direction-xs-column | Styles applied to the root element if direction="column" . |
.MuiGrid-direction-xs-column-reverse | direction-xs-column-reverse | Styles applied to the root element if direction="column-reverse" . |
.MuiGrid-direction-xs-row-reverse | direction-xs-row-reverse | Styles applied to the root element if direction="row-reverse" . |
.MuiGrid-root | root | Styles applied to the root element. |
.MuiGrid-wrap-xs-nowrap | wrap-xs-nowrap | Styles applied to the root element if wrap="nowrap" . |
.MuiGrid-wrap-xs-wrap-reverse | wrap-xs-wrap-reverse | Styles applied to the root element if wrap="reverse" . |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.