Grid
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.
<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.
- columnsTGridTracks'auto'
- grid-template-columns. Three accepted shapes: number (→ repeat(N, 1fr)), string (verbatim CSS), string[] (joined with space). Default 'auto'.
- rowsTGridTracks'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.
- columnGap
- Inline-axis-only gap override. Same accepted shapes as gap.
- Block-axis-only gap override. Same accepted shapes as gap.
- areasstring | ReadonlyArray<string>
- grid-template-areas. Accepts string[] (one entry per row, component adds quotes) or a raw CSS string. Example: ['header header', 'sidebar main'].
- grid-auto-flow. Controls implicit track filling. Values: 'row' | 'column' | 'row dense' | 'column dense'. Default 'row'.
- autoColumnsstring
- grid-auto-columns — sizes for implicit columns. Free-form CSS (e.g. "minmax(0, 1fr)").
- autoRowsstring
- grid-auto-rows — sizes for implicit rows. Free-form CSS.
- align-items (block axis). Values: 'start' | 'end' | 'center' | 'stretch' | 'baseline'. Default '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.
- inlinebooleanfalse
- Toggles display: inline-grid instead of display: grid. Useful for grids that must size to their content.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- tagstring'div'
- HTML element rendered at the root (e.g. "ul", "section").
- heightnumber | string
- Overrides the grid height.
- maxHeightnumber | string
- maxWidthnumber | string
- Maximum grid width.
- minHeightnumber | string
- Minimum grid height.
- minWidthnumber | string
- widthnumber | string
- Overrides the grid width.
- marginboolean | number | string
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- paddingboolean | number | string
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- roundedboolean | number | string | TRounded | null | undefined
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- elevationTElevation
- bgColorTColor
- colorTColor
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>
- borderTopboolean | number | string
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
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.
- dimensionvar(--origam-space---1)
- Gap size xs (4px).
- dimensionvar(--origam-space---2)
- Gap size sm (8px).
- dimensionvar(--origam-space---4)
- Gap size md / default (16px).
- dimensionvar(--origam-space---6)
- Gap size lg (24px).
- dimensionvar(--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
Named template areas
Auto-fill responsive columns