Grid API
API reference docs for the React Grid component. Learn about the props, CSS, and other APIs of this exported module.
Component demos
Import
import Grid from '@mui/system/Unstable_Grid';
// or
import { Unstable_Grid as Grid } from '@mui/system';
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
children | node | The content of the component. | |
columns | Array<number> | number | object | The number of columns. | |
columnSpacing | Array<number | string> | number | object | string | Defines the horizontal space between the type | |
container | bool | If | |
direction | 'column-reverse' | 'column' | 'row-reverse' | 'row' | Array<'column-reverse' | 'column' | 'row-reverse' | 'row'> | object | Defines the | |
disableEqualOverflow | bool | If | |
lg | 'auto' | number | bool | If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the | |
lgOffset | 'auto' | number | If a number, it sets the margin-left equals to the number of columns the grid item uses. If 'auto', the grid item push itself to the right-end of the container. The value is applied for the | |
md | 'auto' | number | bool | If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the | |
mdOffset | 'auto' | number | If a number, it sets the margin-left equals to the number of columns the grid item uses. If 'auto', the grid item push itself to the right-end of the container. The value is applied for the | |
rowSpacing | Array<number | string> | number | object | string | Defines the vertical space between the type | |
sm | 'auto' | number | bool | If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the | |
smOffset | 'auto' | number | If a number, it sets the margin-left equals to the number of columns the grid item uses. If 'auto', the grid item push itself to the right-end of the container. The value is applied for the | |
spacing | Array<number | string> | number | object | string | Defines the space between the type | |
wrap | 'nowrap' | 'wrap-reverse' | 'wrap' | Defines the | |
xl | 'auto' | number | bool | If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for the | |
xlOffset | 'auto' | number | If a number, it sets the margin-left equals to the number of columns the grid item uses. If 'auto', the grid item push itself to the right-end of the container. The value is applied for the | |
xs | 'auto' | number | bool | If a number, it sets the number of columns the grid item uses. It can't be greater than the total number of columns of the container (12 by default). If 'auto', the grid item's width matches its content. If false, the prop is ignored. If true, the grid item's width grows to use the space available in the grid container. The value is applied for all the screen sizes with the lowest priority. | |
xsOffset | 'auto' | number | If a number, it sets the margin-left equals to the number of columns the grid item uses. If 'auto', the grid item push itself to the right-end of the container. The value is applied for 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.