Skip to main content

Reusability

A use is an object (consistent with canvas use):

FieldRequiredDescription
nameYes¹The component's metadata.name. Primary resolution key.
idNoDurable GUID pin; wins over name when both are present.
styleNoNamed style cascaded to the included content's top-level items that declare none.
dataNoScoped $data baked into the component (see Data flow).
overrideNoConfig-merge precedence — see Merge rules.

¹ Either name or id must be present.

Content-level use

Insert a component at a specific position — its content replaces the use in place. Here use is a single object:

{
"document": {
"content": [
{ "use": { "name": "company-header" } },
{ "h1": "Invoice #$data.invoice.number" },
{ "use": { "name": "line-items-table", "data": { "rows": "$data.lineItems" } } },
{ "use": { "name": "signature-block", "style": "muted" } }
]
}
}

Top-level use

List components at the document root to merge their configuration (page setup, header, footer, styles, fonts) and assemble their content. At the document root use is an array — entries compose in list order, their content placed ahead of the document's own:

{
"document": {
"use": [
{ "name": "letterhead", "override": true }
],
"content": [
{ "h1": "My Document" }
]
}
}

A config-only component (a letterhead with header/footer/styles and empty content) contributes only its frame. A content-bearing component contributes its content too.

Data flow

By default a component inherits the parent's full $data context. The data field on a use scopes a per-instance context that is baked into the component's content — exactly as a canvas use.data bakes into a symbol:

{ "use": {
"name": "address-block",
"data": {
"name": "$data.recipient.name",
"city": "$data.recipient.city"
}
} }

Inside the component, $data.name and $data.city resolve from the scoped mapping. Tokens not in scope fall through to the document's later global data pass.

ScenarioBehavior
No data fieldComponent inherits the full parent $data context
"data": { "items": "$data.lineItems" }Component sees $data.items mapped from the parent's lineItems
"data": { "name": "$data.approver.name" }Component sees $data.name as a scalar value

Style cascade

use.style names a style that is stamped onto the included content's top-level items that declare no style of their own — the same cascade as a canvas g/use style. A component's blocks that set their own style keep it; the rest inherit the section default. One handle styles a whole included section without editing the component.

Merge rules

When a component composes into a document, its config merges with the parent:

PropertyDefault (override false)override: true
Page setup / Header / Footer / MetadataHost wins if set, else inheritedComponent wins if it set a value
Styles / FontsAdded if not already defined (host wins on key)Component overwrites same-named entries
Content (content-level use)Replaces the use element in place
Content (top-level use)Concatenated ahead of the document's content, in list order

Default is host-wins: a document keeps the config it declares. Set override: true when a component should own the frame — e.g. a letterhead that supplies the header/footer even if the host declared placeholders.