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 (e.g.1/2
, 2/3
) and fixed/percentage widths, while keeping total content width and spacing consistent.
The grid is implemented with two partials:
columns.html
– multi-column rows with automatic width calculation, gutters, per-column alignment, mobile behavior, 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.
Use the grid system to:
On mobile, columns are output with mobile-12
to stack and span the available width.
1/2
, 2/3
, 3/12
) that are resolved to pixel widths, with rounding that preserves the exact total.columns
or from the highest definedcolNWidth
prop; falls back to equal fractions if no widths are given.<th class="column mobile-12 …" width="…">
cells with per-column alignment, bgcolor, mobile class, and optional column separators.dir="rtl"
on the row while keeping logical source order.Row-level props
Prop | Type | Default | Description |
---|---|---|---|
width | number | page.width (640) | Total row width used for column width calculations. |
padding | number | page.padding | Outer left/right padding for the row (px). |
gutter | number | page.gutter | Space between columns (px). |
bgcolor | string|null | none | Background colour attribute for the row table. |
valign | "top" | "middle" | "bottom" | "top" | Vertical alignment of the row cells. |
mobileClass | string | '' | Default mobile utility class applied to all columns (can be overridden per column). |
feature | "left" | "right" | none | Feature mode adjusts outer padding so the feature column sits flush to the left or right edge. |
borderRight | boolean | false | Adds a vertical divider (right border) between columns, except the last. |
reverse | boolean | false | Reverses visual order (emits dir="rtl") without changing source order. |
columns | number | inferred | Explicit column count. If omitted, inferred from the highest colNWidth provided. |
Per-column props (repeat N
starting at 1)
Prop | Type | Default | Description |
---|---|---|---|
colNWidth | string | number | 1 / columns | Width 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. |
colNMobileClass | string | mobileClass | Mobile class override for column N. |
colNBgColor | string|null | none | Background colour for column N. |
Prop | Type | Default | Description |
---|---|---|---|
width | number | page.width (640) | Total available width before inner padding. |
padding | number | page.padding | Left/right inner padding for the single column (px). |
bgcolor | string|null | none | Background 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. |
mobileClass | string | '' | Mobile utility class for responsive behavior. |
outline | boolean | false | Applies an outer border (panel outline) around the column. |
outlineThickness | number | 1 | Outline/border thickness in pixels. |
outlineColor | string | page.grey[200] | Outline/border colour. |
borderTop | boolean | false | Adds a top border instead of a full outline. |
borderRight | boolean | false | Adds a right border instead of a full outline. |
borderBottom | boolean | false | Adds a bottom border instead of a full outline. |
borderLeft | boolean | false | Adds a left border instead of a full outline. |
rounded | boolean | false | Rounds panel corners (and uses separated borders when needed). |
<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.
<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>
borderRight
adds a divider between columns (not the last).<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.
<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