Data & Layout

Data Binding, Tables & Typst Engine Guide

Learn Handlebars variable syntax, computed aggregates (SUM/COUNT/CURRENCY), conditional visibility, and multi-page flow tables.

Handlebars Syntax & Built-In Functions

Insert variables into Text, Header, Footer, Link, QR Code, or Barcode elements using double curly braces. Open Layout supports deep dot notation as well as safe computed expressions.

expressions.hbs
Company: {{company.name}}
First Line Item: {{items.0.description}}
Subtotal Sum: {{SUM(items.total)}}
Item Count: {{COUNT(items)}} items
Formatted Currency: {{CURRENCY(totals.amountDue)}}

Multi-Page Expanding Flow Tables (No Crushed Rows)

Unlike competitors that require brittle CSS @page rules in Headless Chrome, setting arrayDataPath on a Table element causes our Typst compiler to generate an expanding native #table with repeating table.header rows across page breaks and automatic downward Y-shifting of footer/total boxes.

  • Set arrayDataPath to your JSON array key (e.g. "items" or "manifest.lines").
  • Map each column in columnsConfig with header, field, and align ("left" | "center" | "right").
  • Enable repeatHeader: true so multi-page line-item manifests repeat headers on every overflow page.

Conditional Visibility (visibleIf)

Hide or show watermarks, tax rows, or hazardous material banners per payload by setting visibleIf on any element (e.g. "status == 'PAID'" or "discount > 0").