Grid
The Vivakit Grid is used for building layout using the css grid system. It is customizable and has responsive breakpoints.
Import
import { VKGrid, VKGridItem } from "@vivakits/react-components";
Basic usage
We can define grid row and column size using the rows
and columns
prop. Here, column size xs
means in each column there will be one item, whereas 2xl
is equivalent to 12 columns. On the other hand, rows xs
means there will be one row, whereas 2xl
is equivalent to 6 rows.
Align
We can specify vertical alignment of each grid items using align
prop.
Justify
We can specify horizontal alignment of each grid items using justify
prop.
Gap
We can specify gap between each items using the gap
prop. We can pass sm
, md
, lg
, xl
. Besides we can also pass any number for specific gap size. There is also breakpoint support in grid gap property. So, for each breakpoint specified the gap will be visible accordingly.
Grid Flow
If you want to fit as many possible columns as possible on a row you can use the gridFlow
prop. It has two variants, col
and row
.
API Reference
Grid
Attribute | Type | Description | Default |
---|---|---|---|
columns | defaultxssmmdlgxl2xl | Sets grid column size | xs |
rows | defaultxssmmdlgxl2xl | Sets grid row size | - |
align | startcenterend | Vertical alignment | center |
justify | startcenterend | Horizontal alignment | start |
gap | defaultsmmdlgxlnumberobject | Sets the gap between grids | - |
autoFill | boolean | Fit as many possible columns as possible on a row. Or, as many possible rows on a column | - |
gridFlow | rowcol | Specifies the grid flow direction | - |
className | string | For customizing layout style | - |
GridItem
Attribute | Type | Description | Default |
---|---|---|---|
columnSpan | number | Sets column span property to any specific item | - |
align | startmiddleend | Vertical alignment | center |
justify | startendcenter | Horizontal alignment | start |
className | string | For customizing layout style |