Flex / Grid Layout
Two layout primitives: Flex for one-dimensional layouts (row or column) and Grid for
two-dimensional column grids. Both render as plain <div> elements using design-token spacing.
Add via CLI
Section titled “Add via CLI”npx @a2ra/cli add layoutFlex row
Section titled “Flex row”Flex column
Section titled “Flex column”Example JSON
Section titled “Example JSON”{ "type": "Grid", "props": { "columns": 3, "gap": "md" }, "children": [ { "type": "Card", "children": [{ "type": "Text", "children": "Item 1" }] }, { "type": "Card", "children": [{ "type": "Text", "children": "Item 2" }] }, { "type": "Card", "children": [{ "type": "Text", "children": "Item 3" }] } ]}Flex props
Section titled “Flex props”| Prop | Type | Description |
|---|---|---|
direction | row defaultcolumnrow-reversecolumn-reverse | Flex direction |
gap | nonexssmmd defaultlgxl | Gap between children |
align | start defaultcenterendstretchbaseline | Cross-axis alignment |
justify | start defaultcenterendbetweenaroundevenly | Main-axis distribution |
wrap | truefalse default | Allow children to wrap |
children | node[] | Child nodes |
Grid props
Section titled “Grid props”| Prop | Type | Description |
|---|---|---|
columns | number (1-12) | Number of equal-width columns. Default: 2 |
gap | nonexssmmd defaultlgxl | Gap between cells |
align | start defaultcenterendstretch | Row alignment |
children | node[] | Child nodes |
FlexandGridrender as plain<div>elements with no semantic meaning.- For form layouts, prefer
FormoverFlex—Formwires up React Aria validation context. Gridcolumns are always equal-width. For asymmetric layouts, nest multipleFlexnodes.