Grid
The grid is a layout component to build mobile-first interfaces.
Import
Importimport { Grid } from '@backyard-ui/core';Usage
UsageSize
SizeUse the size prop to set the column width.
Auto Size
Auto SizeTo set a column with variable width use the size prop with value auto.
Grow size
Grow sizeUse isGrow prop to set all columns to width 100%.
Offset
OffsetUse the offset prop to add margin-left to target column.
Gutter
GutterUse the gutter prop to set the gap between columns.
Align and Justify
Align and JustifyUse the align and justify prop to align the columns vertically or horizontally.
Change columns count
Change columns countBy default, the grid uses 12 columns layout, you can change it by setting the columns prop on the Grid component.
In this example, first column takes 50% with size 12 (12/24), second and third take 25% (6/24):
Responsive columns
Responsive columnsYou can make it responsive by passing array or object values into the size prop.
API Reference
API ReferenceRoot
Root- children requiredDescription The children elementsType
ReactNode - alignDescription The CSS `align-items` propertyType
"center" | "start" | "end" | "baseline" | "stretch" - justifyDescription The CSS `justify-content` propertyType
"center" | "start" | "end" | "between" | "around" | "evenly" - columnsDescription The amount of columns in each rowType
numberDefault12 - isGrowDescription If true the all columns will occupy remaining columns by setting 'flex-grow: 1'Type
booleanDefaultfalse - gutterDescription The space between each columnType
"xs" | "sm" | "md" | "lg" | "xl"Defaultlg - noGuttersDescription If true remove the space between columnsType
booleanDefaultfalse - isReverseDescription The CSS `flex-direction` propertyType
booleanDefaultfalse 
Item
Item- sizeDescription The number of columns the component will take place. The value might be a number for all breakpoints or an object that will apply each value based on the key breakpoint, eg: { md: 8 } will create a style for the md media query with a size of 8 columns.Type
ResponsiveValue<number | "auto"> - offsetDescription The number of columns the component will skip. The value might be a number for all breakpoints or an object that will apply each value based on the key breakpoint, eg: { md: 8 } will create a style for the md media query with an offset of 8 columns. Accepts negative values as well.Type
ResponsiveValue<number> - isGrowDescription If true the component will occupy remaining columns by setting 'flex-grow: 1'Type
boolean - children requiredDescription The child nodesType
ReactNode