Grid

Layout & Structure
stable

Declarative CSS Grid container. Exposes every CSS grid property through typed Vue props — no JS track measurement, no fallback to flexbox. columns, rows, gap, areas, autoFlow and alignment props map directly to the corresponding CSS grid properties.

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamGridSchematic of the Grid component with 2 numbered internal parts. item 1 item 2 item 3 1 2
Anatomy of <origam-grid>. The root ① is a single element with CSS Grid properties applied via inline custom properties. Items ② are slotted children — any DOM element, without a BEM wrapper.
1.origam-grid
Root element. display: grid (or inline-grid when inline=true). All grid properties are applied as inline CSS custom properties computed from props.
2(slotted children)
Grid items — any element placed in the default slot. No BEM wrapping. Use grid-area or span CSS on individual items for advanced placement.

API

Props

All props accepted by this component, with their type, default value and description.

columns
TGridTracks
'auto'
grid-template-columns. Three accepted shapes: number (→ repeat(N, 1fr)), string (verbatim CSS), string[] (joined with space). Default 'auto'.
rows
TGridTracks
'auto'
grid-template-rows. Same accepted shapes as columns. Default 'auto'.
Both-axis gap. Accepts a size token ('xs' | 'sm' | 'md' | 'lg' | 'xl'), any CSS length string, or a number (px). columnGap / rowGap override their axis.
Inline-axis-only gap override. Same accepted shapes as gap.
Block-axis-only gap override. Same accepted shapes as gap.
areas
string | ReadonlyArray<string>
grid-template-areas. Accepts string[] (one entry per row, component adds quotes) or a raw CSS string. Example: ['header header', 'sidebar main'].
autoFlow
'row'
grid-auto-flow. Controls implicit track filling. Values: 'row' | 'column' | 'row dense' | 'column dense'. Default 'row'.
autoColumns
string
grid-auto-columns — sizes for implicit columns. Free-form CSS (e.g. "minmax(0, 1fr)").
autoRows
string
grid-auto-rows — sizes for implicit rows. Free-form CSS.
alignItems
'stretch'
align-items (block axis). Values: 'start' | 'end' | 'center' | 'stretch' | 'baseline'. Default 'stretch'.
justifyItems
'stretch'
justify-items (inline axis). Same values as alignItems. Default 'stretch'.
alignContent
align-content — block-axis alignment of the whole grid inside its container when the grid is smaller than the container.
justifyContent
justify-content — inline-axis alignment of the whole grid inside its container.
inline
boolean
false
Toggles display: inline-grid instead of display: grid. Useful for grids that must size to their content.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
tag
string
'div'
HTML element rendered at the root (e.g. "ul", "section").
height
number | string
Overrides the grid height.
maxHeight
number | string
maxWidth
number | string
Maximum grid width.
minHeight
number | string
Minimum grid height.
minWidth
number | string
width
number | string
Overrides the grid width.
margin
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
padding
boolean | number | string
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
rounded
boolean | number | string | TRounded | null | undefined
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
elevation
TElevation
bgColor
TColor
color
TColor
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor

API

Slots

Content slots exposed by this component.

#default
Grid items. Any element placed here participates in the grid layout. Use grid-area or column/row span CSS to position items.

API

Exposed members

Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.

<T extends object>(props: T, exclude?: string[]) => Partial<T>
Filters and forwards a subset of props.
ComputedRef<string | undefined>
Serialised grid-template-columns CSS value computed from the columns prop.
ComputedRef<string | undefined>
Serialised grid-template-rows CSS value computed from the rows prop.
ComputedRef<string | undefined>
Serialised grid-template-areas CSS value computed from the areas prop.
ComputedRef<string | undefined>
Resolved gap value (size token → CSS var reference, or raw CSS value).
ComputedRef<string | undefined>
Resolved column-gap value.
ComputedRef<string | undefined>
Resolved row-gap value.

Customisation

CSS variables

CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.

Gap token for size xs.
Gap token for size sm.
Gap token for size md (default).
Gap token for size lg.
Gap token for size xl.
Computed grid-template-columns value set from the columns prop.
Computed grid-template-rows value set from the rows prop.

Inclusion

Accessibility

ARIA roles, keyboard navigation and focus management. Sourced from the real component template.

Notes

  • The tag prop defaults to "div" — change it to a semantic element when the grid represents a meaningful structure (e.g. tag="ul" with list items, tag="section" for a named region).
  • CSS Grid visual reordering (via order or explicit grid-row/column placement) can diverge from DOM order. Keyboard navigation follows DOM order — avoid visual arrangements that confuse users navigating by Tab.

Foundation

Design tokens

Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.

Source
dimension
var(--origam-space---1)
Gap size xs (4px).
dimension
var(--origam-space---2)
Gap size sm (8px).
dimension
var(--origam-space---4)
Gap size md / default (16px).
dimension
var(--origam-space---6)
Gap size lg (24px).
dimension
var(--origam-space---8)
Gap size xl (32px).

Interactive

Playground

Edit props live and see the component update in real time. The generated code snippet updates as you change values.

Rendering the live preview…

Usage

Examples

Ready-to-paste code snippets for your templates.

N-column grid

vue

Named template areas

vue

Auto-fill responsive columns

vue