Composition
Build complex documents from smaller, reusable pieces. A component is a self-contained block of styles and content that any document — or other component — can drop in with use.
use is the same verb you already know from the SVG: a named component reference, optionally scoped with params and styled with style. Flow composition adds document concerns (config merge precedence); SVG composition adds geometry. One concept, two surfaces.
Why compose?
- Reuse — define a header, a cover page, or an appendix once;
useit from every template - Separate concerns — a designer owns the letterhead component, an analyst owns the body
- Iterate safely — update a component and every document that uses it picks up the change
Where use resolves
use works anywhere content elements appear:
- the top-level content array, columns, table cells and list items;
- header and footer content, the document's and a section break's;
- a watermark's
content, the document's and a section break's; - an svg's
children, as a symbol — a signature'ssvgincluded, which is how a seal component is placed in a signature box.
A watermark holds one node. When its component expands to several, they are stacked in one full-width column, in order, and the report says so with a NOTICE:
{
"document": {
"watermarks": [ { "content": { "use": { "name": "classification-stamp" } }, "angle": 30 } ],
"content": [ { "p": "Body text." } ]
}
}
In this section
- Components — declare a reusable component with the
"component"root key - Reusability — reference components with
use, scope data, cascade styles, and merge configuration - Sections & Watermarks — assemble multi-section documents with per-section frames and watermarks
- Nesting & Pipeline — recursion limits, safety guarantees, and how composition resolves