Skip to main content

text

A single styled string. The most common node by far.
{
  "type": "text",
  "value": "Invoice {{invoice.number}}",
  "style": { "fontSize": 18, "bold": true },
  "align": "right"
}
FieldTypeRequiredNotes
valuestringyesThe text. Supports {{interpolation}}.
styleStylenoTypography for this string. Merged over page.defaultTextStyle.
align"left" · "center" · "right"noDefault left.
A text value can mix literal text and tokens freely: "Total due: {{invoice.total}}".

style

The style object controls typography. Every field is optional; a node’s style merges over the page’s defaultTextStyle.
{
  "fontSize": 10,
  "bold": true,
  "semiBold": false,
  "italic": false,
  "color": "#0f1714"
}
FieldTypeNotes
fontSizenumber (points)Must be greater than 0 when set.
boldbooleanHeavy weight.
semiBoldbooleanMedium weight, between regular and bold.
italicbooleanItalic slant.
colorColorText colour.
Only fontSize and color inherit from page.defaultTextStyle. bold, semiBold, and italic take effect only on the node where you set them — so a page default never silently bolds everything. Set the weight on each node that needs it.

Colours

A colour is either a hex string or a named palette token.
#RGB, #RRGGBB, or #RRGGBBAA (3, 6, or 8 hex digits; case-insensitive). The 8-digit form includes alpha.
{ "color": "#0a9d5f" }
{ "color": "#666" }
{ "color": "#0a9d5f80" }
For brand colours, use hex. For quick, harmonious greys and accents on internal documents, the palette tokens save you picking values — grey.darken1 for muted labels, grey.lighten2 for hairline borders are common choices.

richText

When one line needs more than one style, or a dynamic page number, use richText instead of text. It’s a sequence of spans laid out inline.
{
  "type": "richText",
  "align": "center",
  "spans": [
    { "value": "Page ", "style": { "fontSize": 9, "color": "grey.darken1" } },
    { "pageNumber": true },
    { "value": " of ", "style": { "fontSize": 9, "color": "grey.darken1" } },
    { "totalPages": true }
  ]
}
FieldTypeRequiredNotes
spansSpan[]yesOne or more spans, rendered inline in order.
align"left" · "center" · "right"noDefault left.
A span is one of three shapes:
SpanShapeRenders
Text run{ "value": "…", "style": { … } }Interpolatable, individually styled text.
Page number{ "pageNumber": true }The current page number.
Total pages{ "totalPages": true }The total page count.
pageNumber and totalPages are the only way to print page numbers, and they only make sense in a footer or header (which repeat on every page). In the body they’d render once. See Headers & footers.

Next: Tables

Repeat rows over an array in your data.