GridLegacy API
API reference docs for the React GridLegacy component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import GridLegacy from '@mui/material/GridLegacy';
// or
import { GridLegacy } 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. |
classes | object | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
columns | Array<number> | number | object | 12 | The number of columns. |
columnSpacing | Array<number | string> | number | object | string | - | Defines the horizontal space between the type |
component | elementType | - | The component used for the root node. Either a string to use a HTML element or a component. |
container | bool | false | If |
direction | 'column-reverse' | 'column' | 'row-reverse' | 'row' | Array<'column-reverse' | 'column' | 'row-reverse' | 'row'> | object | 'row' | Defines the |
item | bool | false | If |
lg | 'auto' | number | bool | 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 | 'auto' | number | bool | 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 |
rowSpacing | Array<number | string> | number | object | string | - | Defines the vertical space between the type |
sm | 'auto' | number | bool | 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 |
spacing | Array<number | string> | number | object | string | 0 | Defines the space between the type |
sx | Array<func | object | bool> | func | object | - | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. |
wrap | 'nowrap' | 'wrap-reverse' | 'wrap' | 'wrap' | Defines the |
xl | 'auto' | number | bool | 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 |
xs | 'auto' | number | bool | 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. |
zeroMinWidth | bool | false | If |
ref
is forwarded to the root element.Theme default props
You can use MuiGridLegacy
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 |
---|---|---|
.MuiGridLegacy-container | container | Styles applied to the root element if container={true} . |
.MuiGridLegacy-direction-xs-column | direction-xs-column | Styles applied to the root element if direction="column" . |
.MuiGridLegacy-direction-xs-column-reverse | direction-xs-column-reverse | Styles applied to the root element if direction="column-reverse" . |
.MuiGridLegacy-direction-xs-row-reverse | direction-xs-row-reverse | Styles applied to the root element if direction="row-reverse" . |
.MuiGridLegacy-grid-xs-1 | grid-xs-1 | |
.MuiGridLegacy-grid-xs-10 | grid-xs-10 | |
.MuiGridLegacy-grid-xs-11 | grid-xs-11 | |
.MuiGridLegacy-grid-xs-12 | grid-xs-12 | |
.MuiGridLegacy-grid-xs-2 | grid-xs-2 | |
.MuiGridLegacy-grid-xs-3 | grid-xs-3 | |
.MuiGridLegacy-grid-xs-4 | grid-xs-4 | |
.MuiGridLegacy-grid-xs-5 | grid-xs-5 | |
.MuiGridLegacy-grid-xs-6 | grid-xs-6 | |
.MuiGridLegacy-grid-xs-7 | grid-xs-7 | |
.MuiGridLegacy-grid-xs-8 | grid-xs-8 | |
.MuiGridLegacy-grid-xs-9 | grid-xs-9 | |
.MuiGridLegacy-grid-xs-auto | grid-xs-auto | |
.MuiGridLegacy-grid-xs-true | grid-xs-true | |
.MuiGridLegacy-item | item | Styles applied to the root element if item={true} . |
.MuiGridLegacy-root | root | Styles applied to the root element. |
.MuiGridLegacy-spacing-xs-1 | spacing-xs-1 | |
.MuiGridLegacy-spacing-xs-10 | spacing-xs-10 | |
.MuiGridLegacy-spacing-xs-2 | spacing-xs-2 | |
.MuiGridLegacy-spacing-xs-3 | spacing-xs-3 | |
.MuiGridLegacy-spacing-xs-4 | spacing-xs-4 | |
.MuiGridLegacy-spacing-xs-5 | spacing-xs-5 | |
.MuiGridLegacy-spacing-xs-6 | spacing-xs-6 | |
.MuiGridLegacy-spacing-xs-7 | spacing-xs-7 | |
.MuiGridLegacy-spacing-xs-8 | spacing-xs-8 | |
.MuiGridLegacy-spacing-xs-9 | spacing-xs-9 | |
.MuiGridLegacy-wrap-xs-nowrap | wrap-xs-nowrap | Styles applied to the root element if wrap="nowrap" . |
.MuiGridLegacy-wrap-xs-wrap-reverse | wrap-xs-wrap-reverse | Styles applied to the root element if wrap="reverse" . |
.MuiGridLegacy-zeroMinWidth | zeroMinWidth | Styles applied to the root element if zeroMinWidth={true} . |
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.