Layout
Grid
A grid with star sizing: rows and columns sized to content, as shares of what is left, or in pixels, with children placed by row and column.
WAI-ARIA tested
Import
main.ts
import { Grid } from '@vitral/vue';Definitions
rows="Auto,*,2*,48" columns="160,*,Auto", with showGridLines outlining each cell.
row 0 · Auto — spans 3 columns
rows 1–2 · column 0 (160px)
row 1 (*) · column 1 (*)
row 2 (2*) · column 1
column 2 · Auto
row 3 · 48px
A form
columns="Auto,*": labels take what they need, fields take the rest. Row and column spacing are set separately.
API
Read from packages/vue/src/components/Grid/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| rows | string | (string | number)[] | The row tracks. Left out, the grid has one row that fills it. |
| columns | string | (string | number)[] | The column tracks. Left out, the grid has one column that fills it. |
| rowSpacing | number | string | Space between rows. Defaults to the `grid.rowSpacing` token. |
| columnSpacing | number | string | Space between columns. Defaults to the `grid.columnSpacing` token. |
| showGridLines | boolean | Outlines the grid and every cell: the debugging aid. |
| as | string | Component | — |
Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.
Slots
| Name | Slot props | Description |
|---|---|---|
| default | — | — |