Columns
The columns element creates multi-column layouts within a document. Each column accepts any content node — paragraphs, headings, tables, lists, images, SVG, even nested column layouts — and a column item can combine text with a co-located block, following HTML5 flow-content semantics.
Structure
{
"columns": {
"widths": [1, 1],
"gap": 20,
"rows": [
[
{ "p": "Left column content" }
],
[
{ "p": "Right column content" }
]
]
}
}
Properties
| Property | Type | Required | Description |
|---|---|---|---|
widths | (number | string)[] | No | One track per column: a number is a share (e.g. [3, 1] = 75/25), a string a fixed width, "120pt" or "25%". Picks the grid layout mode. |
columnCount | integer | No | Equal-split column count. Picks the content-flow layout mode (CSS-multicol semantics — content flows across N columns). |
gap | number | No | Gap between columns in points. Absent, the style's columnGap, else 10 |
rows | array[] | Yes | Array of content arrays, one per column (column-major) |
style | string | No | Named style applied to the columns block |
Layout modes
Three branches, each picked by what you wrote:
| You wrote | Layout mode | What it's for |
|---|---|---|
widths: [3, 1] | Grid | Side-by-side panels with explicit widths: ratios, fixed widths or both. widths and columnCount are exclusive: a block states one or the other. |
columnCount: 3 | Content flow | Newspaper-style: a single content stream split across N equal columns. |
| (neither) | Equal grid | Side-by-side equal columns; column count = rows.length. |
The grid path puts rows[i] in column i. The content-flow path concatenates everything in rows into one stream and lets the engine break it across columnCount columns.
In a right-to-left block (a style with direction: "rtl"), the first column is the rightmost, in both modes, as CSS Grid places it.
A grid row is never cut by a page: one that does not fit in the room left moves whole to the next page. A flow longer than the room left starts where it stands and continues on the next page, a line of columns a page; where not even its first line fits, it starts on the next page, and a heading kept with it (breakAfter: "avoid") goes too.
Column widths
The widths array gives each column a track, as CSS grid-template-columns does. A number is a share, an fr weight: the width the gaps leave is divided according to these ratios.
| Widths | Layout |
|---|---|
[1, 1] | Two equal columns |
[2, 1] | Two columns, left is twice as wide |
[1, 2, 1] | Three columns, center is wider |
[1, 1, 1] | Three equal columns |
[3, 1] | Two columns, left takes 75% |
A string is a fixed track: a length with its unit ("120pt", "40mm", "1.5in", "96px") or a percentage of the block's width ("25%"). Fixed tracks keep their size, and the shares divide what they and the gaps leave, so ["120pt", 1] is a 120pt column and one taking the rest. A unit is required: a bare number is a share, never points. Shares that sum to less than 1 take only that part of the room, as CSS has them: ["100pt", 0.5] leaves half of what is left free. Shares alone that sum to less than 1, such as [0.3, 0.6], leave the rest of the block free, and a NOTICE says how much.
| Widths | Layout |
|---|---|
["120pt", 1] | A 120pt column, then one taking the rest |
["30mm", 2, 1] | 30mm, then two thirds and one third of the rest |
["25%", "25%"] | Two columns each a quarter of the block, half of it left free |
Tracks wider than the block keep their size and overflow its end, with a WARNING naming the width they need.
rows.length is the column count. widths is read only when it has one track per column; otherwise the columns are split equally and the mismatch is reported.
Placing the columns: justifyContent
Where fixed tracks leave room, justifyContent on the columns block's style says where it goes, as CSS's justify-content places a grid's tracks:
| Value | Where the room goes |
|---|---|
start (and normal, stretch, flexStart) | after the columns: they stand at the start edge |
end (and flexEnd) | before them: they stand against the end edge |
center | half before, half after |
left, right | the physical edges, whatever the direction |
spaceBetween | all of it between the columns |
spaceAround | half a share at each edge, a whole share between |
spaceEvenly | one share at each edge and between |
{
"document": {
"styles": { "centred": { "justifyContent": "center" } },
"content": [
{ "columns": { "style": "centred", "widths": ["160pt", "160pt"], "rows": [[{ "p": "Left" }], [{ "p": "Right" }]] } }
]
}
}
With shares alone the columns fill the block and there is no room to place. Right to left, start is the right edge and the first column the rightmost. On a column flow (columnCount) the columns fill the block, so justifyContent does nothing there and a NOTICE says so.
Column gap
The gap value sets the horizontal spacing between columns, measured in points. If omitted, the style's columnGap is used, else 10pt. In both modes the gap is the gutter between columns, as CSS column-gap is; the column widths share what is left after the gaps.
Rows
Each element of rows is an array of content elements rendered in that column — the structure is column-major, so rows[0] is the first column's vertical stack of blocks, rows[1] is the second column's stack, and so on. In the content-flow (columnCount) mode the per-row partitioning is flattened: all content becomes one stream.
Column alignment and column boxes
A side-by-side block is a CSS grid row: every column is as tall as the row, and the block's style says where each column's content stands in that height.
| Style key | On | Values | What it does |
|---|---|---|---|
alignItems | the columns block's style | normal (default) or stretch, start, end, center, baseline | Where every column sits in the row. normal and stretch make each column's box as tall as the row, its content at the top; start, end and center shrink a column to its content at the top, the foot or the middle; baseline lines up the columns' first baselines |
alignSelf | a column's own style | the same, plus auto (default) | One column's placement, overriding alignItems |
justifySelf | a column's own style, with a width | start (default), center, end, left, right | Where a column narrower than its track stands across it |
A column's own style is a node with no payload, { "style": "name" }, anywhere in that column's array. It draws nothing itself: it gives the column its box, so the column takes that style's backgroundColor, border, borderRadius and padding, and its alignSelf.
{
"document": {
"styles": {
"row": { "alignItems": "center" },
"panel": { "backgroundColor": "#E0F2FE", "padding": 8, "borderRadius": 4, "alignSelf": "stretch" },
"price": { "fontSize": 20, "fontWeight": "bold" }
},
"content": [
{
"columns": {
"style": "row",
"widths": [2, 1],
"gap": 16,
"rows": [
[
{ "p": "[b]Annual plan[/b]" },
{ "p": "Unlimited documents, every barcode symbology, PDF/A and PDF/UA output." },
{ "p": "Priority support within one business day." }
],
[
{ "style": "panel" },
{ "p": "$480", "style": "price" },
{ "p": "per year" }
]
]
}
}
]
}
}
The right column's panel fills the row's height while the block's center keeps any other column in the middle. With baseline, a heading in one column, small text in another and a table in a third stand on one line: a table's baseline is its first row's.
Flow keys in a style
The content-flow mode can also be asked for from a style, as CSS Multi-column writes it. The columns node's own key wins where both are set.
| Style key | Values | What it does |
|---|---|---|
columnCount | a whole number | How many balanced columns the content flows across |
columnWidth | points | The width of each column: as many as fit, where no count is given |
columnGap | points | The gap between columns, where the node gives no gap |
columnRule | "width style colour", such as "0.5pt solid #9CA3AF" | A rule in the middle of each gap between two columns that both hold content; it takes no room |
columnFill | balance (the default), auto | Whether the columns are balanced or filled in turn, each to the page's foot |
columnSpan | none (the default), all | On a block inside the flow: all lays it across every column, the flow before it balanced above it and the rest continuing in columns below |
These keys are read on a paragraph, a heading and a list too, so a long paragraph can flow in two columns without a columns node. columnRule is drawn in a flow only; on a side-by-side grid it is reported.
{
"document": {
"styles": {
"newsprint": { "columnWidth": 150, "columnGap": 18, "columnRule": "0.5pt solid #9CA3AF" }
},
"content": [
{
"columns": {
"style": "newsprint",
"rows": [
[
{ "h3": "Harbour works" },
{ "p": "Dredging of the outer basin begins in March and runs for eleven weeks. Berths 4 to 7 stay open throughout; berths 1 to 3 close in turn for ten days each." },
{ "p": "Pilots will board at the new station two miles south of the breakwater. Vessels over 180 metres keep their slot times, which the harbour office will confirm a day ahead." },
{ "p": "The fuel berth moves to the east quay for the duration of the works. Tugs remain on station at the inner harbour and can be ordered through the usual channel." }
]
]
}
}
]
}
}
Where the content area is 520pt wide, this makes three columns: as many 150pt columns as fit.
A heading across the columns
columnSpan: "all" on a block in the flow - a section heading, a pull quote, a figure - lays it across the full width.
The flow stops above it, balanced across the columns even under columnFill: "auto", and what follows starts a new line
of columns below it; the column rules stop at it. A block with the key outside a flow, or nested inside another block of
the flow, stays where it is.
{
"document": {
"styles": {
"news": { "columnCount": 3, "columnGap": 16, "columnRule": "0.5pt solid #9CA3AF" },
"section": { "columnSpan": "all", "fontSize": 12, "fontWeight": "bold", "marginTop": 8, "marginBottom": 8 }
},
"content": [
{
"columns": {
"style": "news",
"rows": [
[
{ "p": "Works on the outer basin", "style": "section" },
{ "p": "Dredging of the outer basin begins in March and runs for eleven weeks." },
{ "p": "Ferries and crossings", "style": "section" },
{ "p": "The ferry timetable changes from the first of April." }
]
]
}
}
]
}
}
Edge-case gallery
The fixture below walks through every routing branch and the common edge cases — default equal grid, proportional widths, float weights, widths mismatched against rows.length, empty cells, content-flow mode, many narrow columns, and heterogeneous content. Crimson dashed outlines mark each columns block so the boundaries are visible.
- Output
- Template
- Data
Examples
Two-column layout: sender and recipient
{
"columns": {
"widths": [1, 1],
"gap": 20,
"rows": [
[
{ "p": "[b]From:[/b]" },
{ "p": "ShipForge Ltd" },
{ "p": "45 Innovation Drive" },
{ "p": "London, UK" }
],
[
{ "p": "[b]To:[/b]" },
{ "p": "Meridian Logistics" },
{ "p": "742 Evergreen Terrace" },
{ "p": "Denver, CO" }
]
]
}
}
Three-column KPI dashboard
{
"document": {
"styles": {
"kpiLabel": { "fontWeight": "bold", "fontSize": 10, "color": "#333333" },
"kpiValue": { "fontSize": 24, "fontWeight": "bold", "color": "#1A1A2E" },
"kpiNote": { "fontSize": 8, "color": "#999999" }
},
"content": [
{
"columns": {
"widths": [1, 1, 1],
"gap": 15,
"rows": [
[
{ "p": "Revenue", "style": "kpiLabel" },
{ "p": "$1.87M", "style": "kpiValue" },
{ "p": "Target: $1.75M", "style": "kpiNote" }
],
[
{ "p": "Customers", "style": "kpiLabel" },
{ "p": "2,340", "style": "kpiValue" },
{ "p": "Growth: +14.1%", "style": "kpiNote" }
],
[
{ "p": "Satisfaction", "style": "kpiLabel" },
{ "p": "94%", "style": "kpiValue" },
{ "p": "NPS: 72", "style": "kpiNote" }
]
]
}
}
]
}
}
Asymmetric layout: wide content with sidebar
{
"columns": {
"widths": [3, 1],
"gap": 25,
"rows": [
[
{ "p": "[b]Shipment Details[/b]" },
{ "p": "Your package has been dispatched from the Chicago hub and is currently in transit to the Toronto distribution center. Expected delivery window is April 3-5, 2026." },
{
"table": {
"widths": [1, 2],
"rows": [
[{ "p": "[b]Tracking ID[/b]" }, { "p": "SF-20260330-001" }],
[{ "p": "[b]Weight[/b]" }, { "p": "12.4 kg" }],
[{ "p": "[b]Carrier[/b]" }, { "p": "ShipForge Express" }]
]
}
}
],
[
{ "p": "[b]Quick Links[/b]" },
{
"ul": {
"li": [
{ "p": "Track online" },
{ "p": "Contact support" },
{ "p": "File a claim" }
]
}
},
{ "p": "[barcode, qrcode, SF-20260330-001, 80|80]" }
]
]
}
}
Newspaper-style content flow with columnCount
When you have a single long content stream that should flow across N equal columns (CSS-multicol semantics), use columnCount instead of widths.
{
"columns": {
"columnCount": 3,
"gap": 14,
"rows": [
[
{ "h3": "Summary" },
{ "p": "The fiscal-year report consolidates revenue, customer growth, and product-line performance across all three operating regions." },
{ "p": "Year-over-year revenue growth reached 18.4%, driven primarily by enterprise renewals and expansion into the Mid-Atlantic corridor." },
{ "p": "Customer retention held at 94.2% — the strongest figure since 2024 — while net-new acquisitions outpaced churn for the eleventh consecutive quarter." }
]
]
}
}
PDF breaks the stream into 3 equal columns with true content reflow. DOCX writes the flow as a section of 3 columns, which Word fills and balances itself, so its lines may break in other places. Inside a table cell, a box or a header or footer no section can open: there the DOCX writes the stream as one column, and reports it.
How a flow is balanced
The columns of a flow are balanced: their bottoms sit within a line of each other. A paragraph cut by a column boundary resumes at the top of the next column, as it would at a page break. A heading that would land alone at a column's foot is carried to the next column when its style says breakAfter: "avoid". A flow that continues across pages fills every page's columns but the last, and only the last is balanced.
columnFill: "auto" on the flow's style fills the columns in turn instead: the first to the page's foot, then the next. A flow shorter than one column stays in the first, with what follows under it; one that fills its first column takes the rest of the page.
Column breaks
breakBefore: "column" on a block of the flow starts it at the top of the next column, and breakAfter: "column" ends its column after it, as CSS Fragmentation writes them. The block keeps its top margin at the column's top, where an ordinary column boundary drops it. The flow is then as tall as its tallest part, and a part that finds no column left on the page opens the next page's line of columns. A column break counts only on the flow's own blocks: outside a flow, or on a block inside a list or table in one, it does nothing, and the render report says so.
{
"columns": {
"columnCount": 3,
"rows": [[
{ "h3": "Arrivals" }, { "p": "..." },
{ "h3": "Departures", "style": "newColumn" }, { "p": "..." },
{ "h3": "Transfers", "style": "newColumn" }, { "p": "..." }
]]
}
}
With "newColumn": { "breakBefore": "column" } in styles, each heading opens a column of its own.
Nesting containers in columns
A column stacks any content, including a nested table, ul/ol, or another columns layout — and a column item can pair text with a co-located block. This makes each column a full mini-layout, not just a text stack.
Inside a column, a block's unstated margin is 0, so blocks in a column touch unless their styles say otherwise; a margin a style states is kept. A columns block inside a table cell or a list item is as wide as its host.
{
"columns": {
"widths": [1, 1],
"gap": 16,
"rows": [
[
{ "p": "Balances", "style": "label" },
{
"table": {
"widths": [2, 1],
"rows": [
[{ "td": "Current" }, { "td": "$18,240" }],
[{ "td": "Available" }, { "td": "$1,760" }]
]
}
}
],
[
{ "p": "Action items", "style": "label" },
{ "ol": { "li": [ { "p": "Verify address" }, { "p": "Confirm autopay" } ] } }
]
]
}
}
In DOCX
A side-by-side block is written as one table row that Word does not split, with the gaps as their own columns. alignItems and alignSelf become each cell's vertical alignment (top, middle or bottom). A column box narrower than its column is a cell of its own width between empty ones, as the gaps are, and so is the room justifyContent leaves before and after the columns. A box sized to its content's height (alignItems other than stretch) with a border or a fill, and a shared baseline, have no form there and are reported. A flow is written as a section of N columns, as described above; a columnRule is drawn as one plain line, and its style, width and colour are reported when they differ. A column break is a Word column break in a paragraph of its own, and a flow with columnFill: "auto" ends in one, which keeps Word from balancing it. A spanner is a section of one column between two continuous section breaks, and Word balances the columns above it.
Data references in columns
Column content supports $data references just like any other content element.
{
"columns": {
"widths": [1, 1],
"gap": 20,
"rows": [
[
{ "p": "[b]From:[/b] $data.company.name" },
{ "p": "$data.company.address" },
{ "p": "$data.company.city" }
],
[
{ "p": "[b]To:[/b] $data.client.companyName" },
{ "p": "$data.client.address" },
{ "p": "$data.client.city" }
]
]
}
}