Skip to content

Grid API

API reference docs for the React Grid component. Learn about the props, CSS, and other APIs of this exported module.

Demos

For examples and details on the usage of this React component, visit the component demo pages:

Import

import Grid from '@mui/system/Unstable_Grid';
// or
import { Unstable_Grid as Grid } from '@mui/system';
Learn about the difference by reading this guide on minimizing bundle size.

Props

Props of the native component are also available.

children

The content of the component.

Type:

node

columns

The number of columns.

Type:

Array<number> | number | object

columnSpacing

Defines the horizontal space between the type item components. It overrides the value of the spacing prop.

Type:

Array<number | string> | number | object | string

container

If true, the component will have the flex container behavior. You should be wrapping items with a container.

Type:

bool

direction

Defines the flex-direction style property. It is applied for all screen sizes.

Type:

'column-reverse' | 'column' | 'row-reverse' | 'row' | Array<'column-reverse' | 'column' | 'row-reverse' | 'row'> | object

disableEqualOverflow

If true, the negative margin and padding are apply only to the top and left sides of the grid.

Type:

bool

lg

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 lg breakpoint and wider screens if not overridden.

Type:

'auto' | number | bool

lgOffset

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 lg breakpoint and wider screens if not overridden.

Type:

'auto' | number

md

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 md breakpoint and wider screens if not overridden.

Type:

'auto' | number | bool

mdOffset

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 breakpoint and wider screens if not overridden.

Type:

'auto' | number

rowSpacing

Defines the vertical space between the type item components. It overrides the value of the spacing prop.

Type:

Array<number | string> | number | object | string

sm

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 sm breakpoint and wider screens if not overridden.

Type:

'auto' | number | bool

smOffset

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 sm breakpoint and wider screens if not overridden.

Type:

'auto' | number

spacing

Defines the space between the type item components. It can only be used on a type container component.

Type:

Array<number | string> | number | object | string

wrap

Defines the flex-wrap style property. It's applied for all screen sizes.

Type:

'nowrap' | 'wrap-reverse' | 'wrap'

xl

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 xl breakpoint and wider screens if not overridden.

Type:

'auto' | number | bool

xlOffset

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 xl breakpoint and wider screens if not overridden.

Type:

'auto' | number

xs

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.

Type:

'auto' | number | bool

xsOffset

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 breakpoint and wider screens if not overridden.

Type:

'auto' | number

As a CSS utility, the Grid component also supports all system properties. You can use them as props directly on the component.

The 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.