Grid
The Grid component is a framework for building modular layouts.
- To structure the layout of a page
How to use it
The Grid component is modeled on Bootstrap’s Grid system. The following examples link to corresponding Bootstrap documentation and demonstrate how advanced layouts can be achieved using Grid.
Auto layout
Equal column widths
Equal-width multi-row
Setting one column width
Variable width content
Responsive layouts
All breakpoints
Stacked to horizontal
Alignment
Vertical alignment
Horizontal alignment
No gutters
Column wrapping
Column breaks
Offsetting columns
Nesting
Configuration
- Name9.4.0•View source•View on npm
- Installnpm install @zendeskgarden/react-grid
- Depsnpm install react react-dom styled-components @zendeskgarden/react-theming
- Importimport { Grid } from '@zendeskgarden/react-grid'
API
Grid
Prop name | Type | Default | Description |
---|---|---|---|
columns | string | number | 12 | Defines the number of individual columns that the grid contains |
debug | boolean | Highlights the columns for layout debugging | |
gutters | false | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxs' | 'xxl' | 'md' | Specifies the grid column gutter width. The value |
Grid.Col
Extends HTMLAttributes<HTMLDivElement>
Prop name | Type | Default | Description |
---|---|---|---|
alignSelf | 'end' | 'start' | 'auto' | 'center' | 'baseline' | 'stretch' | Applies the | |
alignSelfLg | 'end' | 'start' | 'auto' | 'center' | 'baseline' | 'stretch' | Applies the | |
alignSelfMd | 'end' | 'start' | 'auto' | 'center' | 'baseline' | 'stretch' | Applies the | |
alignSelfSm | 'end' | 'start' | 'auto' | 'center' | 'baseline' | 'stretch' | Applies the | |
alignSelfXl | 'end' | 'start' | 'auto' | 'center' | 'baseline' | 'stretch' | Applies the | |
alignSelfXs | 'end' | 'start' | 'auto' | 'center' | 'baseline' | 'stretch' | Applies the | |
lg | string | number | boolean | Defines the column size on large screens | |
md | string | number | boolean | Defines the column size on medium screens | |
offset | string | number | Offsets the column relative to the total number of | |
offsetLg | string | number | Applies offset to the column on large screens | |
offsetMd | string | number | Applies offset to the column on medium screens | |
offsetSm | string | number | Applies offset to the column on small screens | |
offsetXl | string | number | Applies offset to the column on extra-large screens | |
offsetXs | string | number | Applies offset to the column on extra-small screens | |
order | string | number | Applies the | |
orderLg | string | number | Sets the | |
orderMd | string | number | Sets the | |
orderSm | string | number | Sets the | |
orderXl | string | number | Sets the | |
orderXs | string | number | Sets the | |
size | string | number | Sets the total number of grid | |
sm | string | number | boolean | Defines the column size on small screens | |
textAlign | 'end' | 'start' | 'center' | 'justify' | Applies the RTL-aware | |
textAlignLg | 'end' | 'start' | 'center' | 'justify' | Applies the | |
textAlignMd | 'end' | 'start' | 'center' | 'justify' | Applies the | |
textAlignSm | 'end' | 'start' | 'center' | 'justify' | Applies the | |
textAlignXl | 'end' | 'start' | 'center' | 'justify' | Applies the | |
textAlignXs | 'end' | 'start' | 'center' | 'justify' | Applies the | |
xl | string | number | boolean | Defines the column size on extra-large screens | |
xs | string | number | boolean | Defines the column size on extra-small screens. See breakpoints. |
Grid.Row
Extends HTMLAttributes<HTMLDivElement>
Prop name | Type | Default | Description |
---|---|---|---|
alignItems | 'end' | 'start' | 'center' | 'baseline' | 'stretch' | Applies the | |
alignItemsLg | 'end' | 'start' | 'center' | 'baseline' | 'stretch' | Applies the | |
alignItemsMd | 'end' | 'start' | 'center' | 'baseline' | 'stretch' | Applies the | |
alignItemsSm | 'end' | 'start' | 'center' | 'baseline' | 'stretch' | Applies the | |
alignItemsXl | 'end' | 'start' | 'center' | 'baseline' | 'stretch' | Applies the | |
alignItemsXs | 'end' | 'start' | 'center' | 'baseline' | 'stretch' | Applies the | |
justifyContent | 'end' | 'start' | 'center' | 'between' | 'around' | Applies the | |
justifyContentLg | 'end' | 'start' | 'center' | 'between' | 'around' | Applies the | |
justifyContentMd | 'end' | 'start' | 'center' | 'between' | 'around' | Applies the | |
justifyContentSm | 'end' | 'start' | 'center' | 'between' | 'around' | Applies the | |
justifyContentXl | 'end' | 'start' | 'center' | 'between' | 'around' | Applies the | |
justifyContentXs | 'end' | 'start' | 'center' | 'between' | 'around' | Applies the | |
wrap | 'wrap' | 'nowrap' | 'wrap-reverse' | Applies the | |
wrapLg | 'wrap' | 'nowrap' | 'wrap-reverse' | Applies the | |
wrapMd | 'wrap' | 'nowrap' | 'wrap-reverse' | Applies the | |
wrapSm | 'wrap' | 'nowrap' | 'wrap-reverse' | Applies the | |
wrapXl | 'wrap' | 'nowrap' | 'wrap-reverse' | Applies the | |
wrapXs | 'wrap' | 'nowrap' | 'wrap-reverse' | Applies the |