A NSW Government website

Command Palette

Search for a command to run...

Grid system

The grid system provides table-based layout components for creating responsive email designs that render reliably across all major clients. It supports both semantic fractions (such as 1/2, 2/3) and fixed/percentage widths, while keeping total content width and spacing consistent.

What it is

The grid is implemented with 2 partials:

  • columns.html – multi-column rows with automatic width calculation, gutters, per-column alignment, mobile behaviour, and optional “feature” layouts.
  • column.html – a single, full-width content column with optional outlines/borders, rounded corners, and controlled padding.

Both components output email-safe <table> markup.

Examples

No padding

No gutters

No gutters and padding

Three column

Four column

When to use

Use the grid system to:

  • Build single-, two-, or multi-column layouts
  • Mix fractions, percentages, and fixed pixel widths within the same row when needed
  • Create feature layouts (e.g. a hero image/text pair with asymmetric outer padding) using left/right “feature” modes
  • Maintain a consistent content width and gutter/padding rhythm across templates

On mobile, columns are output with mobile-12 to stack and span the available width.

Multi-column rows

  • Accepts a total row width, outer padding, and gutter; computes the space available for columns and distributes it by fixed/percent/fraction rules
  • Supports a rich set of fraction tokens (e.g. 1/2, 2/3, 3/12) that are resolved to pixel widths, with rounding that preserves the exact total
  • Calculates the total gutter/outer padding differently when a featurecolumn is pinned to the left or right, so visual edges align cleanly
  • Derives the number of columns either from columns or from the highest definedcolNWidth prop; falls back to equal fractions if no widths are given
  • Outputs <th class="column mobile-12 …" width="…"> cells with per-column alignment, bgcolor, mobile class, and optional column separators
  • Can reverse visual order (useful for RTL or image/text swaps) by emittingdir="rtl" on the row while keeping logical source order

Single column

  • Computes inner width from the page width minus left/right padding, then renders a centred, single-column row.
  • Supports outline and individual borders (top/right/bottom/left) with configurable thickness and colour; can also round corners.
  • Exposes text alignment, cell alignment, bgcolor, mobile class, and valign.

Props

columns.html

Row-level props

PropTypeDefaultDescription
widthnumberpage.width (640)Total row width used for column width calculations.
paddingnumberpage.paddingOuter left/right padding for the row (px).
gutternumberpage.gutterSpace between columns (px).
bgcolorstring|nullnoneBackground colour attribute for the row table.
valign"top" | "middle" | "bottom""top"Vertical alignment of the row cells.
mobileClassstring''Default mobile utility class applied to all columns (can be overridden per column).
feature"left" | "right"noneFeature mode adjusts outer padding so the feature column sits flush to the left or right edge.
borderRightbooleanfalseAdds a vertical divider (right border) between columns, except the last.
reversebooleanfalseReverses visual order (emits dir="rtl") without changing source order.
columnsnumberinferredExplicit column count. If omitted, inferred from the highest colNWidth provided.

Per-column props (repeat N starting at 1)

PropTypeDefaultDescription
colNWidthstring | number1 / columnsWidth for column N. Accepts fraction (e.g. "2/3"), percent (e.g. "33%"), or fixed px (e.g. "300").
colNAlign"left" | "center" | "right""left"Text alignment for column N.
colNMobileClassstringmobileClassMobile class override for column N.
colNBgColorstring|nullnoneBackground colour for column N.

column.html

PropTypeDefaultDescription
widthnumberpage.width (640)Total available width before inner padding.
paddingnumberpage.paddingLeft/right inner padding for the single column (px).
bgcolorstring|nullnoneBackground colour attribute for the row table.
align"left" | "center" | "right""left"Horizontal alignment of the inner cell.
textAlign"left" | "center" | "right""left"CSS text alignment applied to the column content.
valign"top" | "middle" | "bottom""top"Vertical alignment of the row.
mobileClassstring''Mobile utility class for responsive behaviour.
outlinebooleanfalseApplies an outer border (panel outline) around the column.
outlineThicknessnumber1Outline/border thickness in pixels.
outlineColorstringpage.grey[200]Outline/border colour.
borderTopbooleanfalseAdds a top border instead of a full outline.
borderRightbooleanfalseAdds a right border instead of a full outline.
borderBottombooleanfalseAdds a bottom border instead of a full outline.
borderLeftbooleanfalseAdds a left border instead of a full outline.
roundedbooleanfalseRounds panel corners (and uses separated borders when needed).

Code examples

Two-column (fractions)

<x-columns columns="2" col1Width="1/3" col2Width="2/3" gutter="16" padding="48">
  <slot:col1>
    <!-- Left column content -->
  </slot:col1>
  <slot:col2>
    <!-- Right column content -->
  </slot:col2>
</x-columns>

Fractions are mapped and rounded so totals match precisely.

Three-column (fixed + percent + fraction)

<x-columns columns="3" col1Width="200" col2Width="33%" col3Width="1/3" gutter="16" padding="32" borderRight>
  <slot:col1>…</slot:col1>
  <slot:col2>…</slot:col2>
  <slot:col3>…</slot:col3>
</x-columns>
  • Mixed width types are supported and resolved in order: fixed, percent, then fractions.
  • borderRight adds a divider between columns (not the last).

Feature layout (image/text)

<x-columns columns="2" feature="left" col1Width="320" col2Width="1/2" gutter="16" padding="48">
  <slot:col1><!-- Feature image --></slot:col1>
  <slot:col2><!-- Text content --></slot:col2>
</x-columns>

Feature mode adjusts outer padding so the feature column sits flush at the edge.

Single column with outline

<x-column padding="48" outline outlineThickness="2" outlineColor="#cbedfd" textAlign="center" rounded>
  <!-- Centered content inside a boxed panel -->
</x-column>

Controlled inner padding, optional outline/rounded corners, and text alignment.

Do / Don't

Do

  • Use fractions for semantic layouts; switch to fixed orpercentage widths when you need exact sizing
  • Keep gutter and outer padding consistent for a clean rhythm
  • Use reverse when you need visual order flipped without changing source order

Don't

  • Hard-code tables for grids – always use the partials to benefit from consistent calculations and mobile behaviour
  • Over-nest rows/columns; keep structures shallow for readability and client robustness
  • Mix too many unrelated width schemes in one row unless necessary (readability and quality assurance suffer)
Previous
Section