JGuang

Grid

Grid · Arco Design

Preview
npm install @arco-design/web-react@2.66.18

Grid

Grid can effectively ensure the consistency and logic of the page, strengthen teamwork and unity.

Install

npm install @arco-design/web-react@2.66.18

Import @arco-design/web-react/dist/css/arco.css at the entry and set the locale with ConfigProvider. React 19 projects must also import @arco-design/web-react/es/_util/react-19-adapter first, or imperative APIs such as Message and Modal cannot render.

Examples

  • Basic: The basic usage of Grid.
  • Offset of Col: Specify offset to justify the padding of Col.
  • Push pull: Specify push or pull to sort the grid.
  • Interval of Grid: By specifying gutter on Row, the area interval of the grid can be changed.
  • Horizontal layout: Use justify to customize horizontal layout.
  • Vertical layout: Use align to customize vertical layout.
  • Order: Sort items by order.
  • Responsive layout: Six preset sizes are available: xs, sm, md, lg, xl and xxl.
  • Advanced responsive layout: The span, offset, order, , pull, push properties can be used in xs, sm, md, lg, xl, xxl objects. For example, xs={8} is equivalent to xs={{ span: 8 }}.
  • Flex: By setting the flex property of the Col component, you can configure the flex layout arbitrarily.
  • Grid Layout: A layout component implemented by CSS-based Grid layout, supports folding, and can set suffix nodes, which will always be displayed at the end of a line.
  • Responsive Grid Layout: The responsive configuration format of the Grid component is { xs: 1, sm: 2, md: 3, lg: 4, xl: 5, xxl: 6, xxxl: 7 }.

Examples come from the official Arco Design repository (MIT) at the commit published as npm 2.66.18. Some use online images or upload endpoints; network requests are disabled in previews.

API

Row

PropertyDescriptionTypeDefaultValueVersion
divIf true, <Row> and <Col> will be treated as a div without any Grid related classes and stylesboolean--
alignVertical alignment, same as css align-items'start' | 'center' | 'end' | 'stretch'start-
justifyHorizontal alignment, same as css justify-content'start' | 'center' | 'end' | 'space-around' | 'space-between'start-
classNameAdditional css classstring | string[]--
gutterSpacing between grids, could be a number or a object like { xs: 8, sm: 16, md: 24}.Or you can use array to make horizontal and vertical spacing work at the same time [horizontal, vertical]GridRowGutter | Array<GridRowGutter>0vertical gutter in 2.5.0
styleAdditional styleCSSProperties--

Col

PropertyDescriptionTypeDefaultValueVersion
offsetThe number of cells to offset Col from the leftnumber--
orderRaster ordernumber--
pullRaster ordernumber-2.20.0
pushRaster ordernumber-2.20.0
spanRaster number of cells to occupynumber24-
classNameAdditional css classstring | string[]--
flexSet flex layout propertiesFlexType-2.26.0
lgscreen >= 992pxnumber | { [key: string]: any }--
mdscreen >= 768pxnumber | { [key: string]: any }--
smscreen >= 576pxnumber | { [key: string]: any }--
styleAdditional styleCSSProperties--
xlscreen >= 1200pxnumber | { [key: string]: any }--
xsscreen < 576pxnumber | { [key: string]: any }--
xxlscreen >= 1600pxnumber | { [key: string]: any }--
xxxlscreen >= 2000pxnumber | { [key: string]: any }-2.40.0

Grid

PropertyDescriptionTypeDefaultValue
collapsedWhether to collapsedbooleanfalse
collapsedRowsNumber of rows displayed when collapsednumber1
classNameAdditional css classstring | string[]-
colGapThe space in column-to-columnnumber | ResponsiveValue0
colsNumber of columns displayed in each rownumber | ResponsiveValue24
rowGapThe space in row-to-rownumber | ResponsiveValue0
styleAdditional styleCSSProperties-

GridItem

PropertyDescriptionTypeDefaultValue
suffixIs it a suffix elementbooleanfalse
classNameAdditional css classstring | string[]-
offsetNumber of grids on the leftnumber | ResponsiveValue0
spanNumber of grids spannednumber | ResponsiveValue1
styleAdditional styleCSSProperties-

ResponsiveValue

PropertyDescriptionTypeDefaultValue
lg>= 992px responsive configurationnumber-
md>= 768px responsive configurationnumber-
sm>= 576px responsive configurationnumber-
xl>= 1200px responsive configurationnumber-
xs< 576px responsive configurationnumber-
xxl>= 1600px responsive configurationnumber-
xxxlscreen >= 2000pxnumber-

GridRowGutter

export type GridRowGutter =
  | number
  | Partial<Record<GridResponsiveBreakpoint, number>>;

FlexType

export type FlexType = string | number | "auto" | "none";