--- productId: joy-ui title: React Grid component components: Grid githubLabel: 'component: Grid' --- # Grid
Grid acts as a generic container, wrapping around the elements to be arranged.
{{"component": "@mui/docs/ComponentLinkHeader"}} ## Introduction The Grid component, based on a 12-column grid layout, creates visual consistency between layouts while allowing flexibility across a wide variety of designs. :::warning The `Grid` component shouldn't be confused with a data grid; it is closer to a layout grid. For a data grid head to the [MUI X Data Grid](/x/react-data-grid/) component. ::: ## Basics ```jsx import Grid from '@mui/joy/Grid'; ``` Column widths are integer values between 1 and 12. For example, an item with `size={6}` occupies half of the grid container's width. {{"demo": "BasicGrid.js", "bg": true}} ## Customization ### Grid with multiple breakpoints Components may have multiple widths defined, causing the layout to change at the defined breakpoint. Width values given to larger breakpoints override those given to smaller breakpoints. For example, `size={{ xs: 12, sm: 6 }}` sizes a component to occupy half of the viewport width (6 columns) when viewport width is 600 or more pixels. For smaller viewports, the component fills all 12 available columns. {{"demo": "FullWidthGrid.js", "bg": true}} ### Spacing To control space between children, use the `spacing` prop. The spacing value can be any positive number, including decimals and any string. The prop is converted into a CSS property using the [`theme.spacing()`](/material-ui/customization/spacing/) helper. {{"demo": "SpacingGrid.js", "bg": true}} ### Row & column spacing The `rowSpacing` and `columnSpacing` props allow for specifying the row and column gaps independently. It's similar to the `row-gap` and `column-gap` properties of [CSS Grid](/system/grid/#row-gap-amp-column-gap). {{"demo": "RowAndColumnSpacing.js", "bg": true}} ### Responsive values You can switch the props' value based on the active breakpoint. {{"demo": "ResponsiveGrid.js", "bg": true}} Responsive values is supported by: - `size` - `columns` - `columnSpacing` - `direction` - `rowSpacing` - `spacing` - `offset` - all the [other props](#system-props) of MUI System :::warning When using a responsive `columns` prop, each grid item needs its corresponding breakpoint. For instance, this is not working. The grid item misses the value for `md`: ```jsx