Grid API
Demos
For examples and details on the usage of this React component, visit the component demo pages:
Import
import Grid from '@mui/material/Grid';
// or
import { Grid } from '@mui/material';
Props
Props of the native component are also available.
Defines the horizontal space between the type item
components. It overrides the value of the spacing
prop.
Type:
Array<number | string> | number | object | string
If true
, the component will have the flex container behavior. You should be wrapping items with a container.
Type:
bool
Default:
false
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
Default:
'row'
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
Default:
false
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
Default:
false
Defines the vertical space between the type item
components. It overrides the value of the spacing
prop.
Type:
Array<number | string> | number | object | string
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
Default:
false
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
Default:
0
Defines the flex-wrap
style property. It's applied for all screen sizes.
Type:
'nowrap' | 'wrap-reverse' | 'wrap'
Default:
'wrap'
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
Default:
false
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
Default:
false
system
properties. You can use them as props directly on the component.ref
is forwarded to the root element.Theme default props
You can useMuiGrid
to change the default props of this component with the theme.CSS
The following class names are useful for styling with CSS (the state classes are marked).
To learn more, visit the component customization page.
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.