Authoring

Components

How a template uses a kit's components — names and aliases, typed attributes, bindings, content, children, ordering rules and limits.

A template's body is a stack of components, and the kit decides which components exist. Each one has a schema, components/<name>/component.yaml, that lists its attributes and bindings, the Markdown it takes, its children and its rules. The compiler checks every use against that schema, so a template that compiles is one the kit knows how to render.

This page is about using components. Writing a schema is covered in Component schemas.

Look up the kit's components

Plain has six components. Loose Markdown between components goes into section, its default.

ComponentAttributesContentChildren
sectionnoneparagraphs, #–### headings, lists, action rows, tables (with a header row), images; strikethrough—
buttonhref (url, required), label (text, required)none—
imagesrc (url, required), alt (text, required), width (int, default 496), href (url), caption (text)none—
columnsnonenone2 to 3 :::column
columnnoneparagraphs, ##–### headings, lists, action rows; strikethrough—
footernote (inline)none—

Quiet has 24, from statement and receipt to stories and signoff, with letter as its default. They are catalogued, with a preview of each, in The Quiet kit. To use a kit of your own, read its components/ directory: every rule on this page comes from a key in a component.yaml.

375 px · mobile

Name a component

Write a component by its name, which is its directory under components/, or by one of its aliases. Both are matched case-insensitively and compile to the same component. Quiet gives most of its components the design handoff's IDs as aliases, so ::k1 is ::statement and ::c1, ::c2 and ::c3 are all ::actions.

A name the kit doesn't know is an error at the opener: unknown component "callout". Every other message names the component by its canonical name, whichever name the template used.

Set attributes

The schema's attrs give every key a type. The parser reads all values as text, and the compiler then checks each one against its type:

TypeWrite it asError when wrong
textAny text. Merge tags allowed.—
urlText that evaluates to a URL. Merge tags allowed, escaped by the URL rules and checked at render.image: src: url "": empty (at render)
intA literal integer, or a YAML integer in props.image: "width" must be an integer
flagA bare key, true or false, or a YAML boolean in props.table: "headless" must be a flag
enumOne of the schema's values, literally.statement: tone must be "orange"
listA comma-separated literal, or a YAML list in props. No merge tags.progress: "steps" must be literal text
inlineOne paragraph of inline Markdown. Merge tags allowed.footer: "note" must be one paragraph

Three more keys shape what a template must give:

  • required: the key must be set and, for text, url and inline, not blank. Otherwise image: missing "alt".
  • required_with: the key is required once another key is set. Quiet's image takes a src, and then needs an alt: image: alt is required when src is set.
  • default: the value a key has when the template leaves it out. Plain's image is 496 px wide unless width says otherwise.

Plain's image shows all three:

plain/components/image/component.yaml
# A full-width image (or narrower with width), with an optional link and
# caption.
name: image
attrs:
  src:     { type: url, required: true }
  alt:     { type: text, required: true }
  # Width in px. The default and the cap in html.tmpl are size.content in
  # kit.yaml (templates cannot compare an int with a token); change all
  # three together.
  width:   { type: int, default: "496" }
  href:    { type: url }
  caption: { type: text }
content: none
spacing:
  top: 0
  bottom: size.gap
templates/welcome.md
::image{src="{{cover_url}}" alt="An empty workspace" width="320" href="https://example.com/projects"}
::

Any key the schema doesn't declare, an #id or a .class is button: unknown attribute "target". Attributes and props are one set of keys, so the same key in both is button: "label" set twice.

Pass bindings

Some components need a structured value rather than a line of text: an invoice, a receipt, a list of products. The schema declares these under bindings, each with a Go type the kit registers, and the template passes one with :key="path":

tutorial/templates/invoice.md#L12-L13
::invoice{:invoice="invoice"}
::

That binding comes from the kit built in Build your own kit. Its invoice component binds the Go type Invoice:

tutorial/kit/components/invoice/component.yaml
# An invoice: the bound Invoice's lines, then its total. A template
# passes the invoice with a binding: ::invoice{:invoice="invoice"}.
name: invoice
attrs:
  title: { type: text, default: Invoice }
bindings:
  invoice: { type: Invoice, required: true }
content: none
spacing:
  top: size.block
  bottom: size.gap

A binding resolves with the same path rules as a merge tag, but it must resolve to exactly the registered type. The errors, from Quiet's receipt, which binds a quiet.Receipt, and one from Plain:

TemplateError
::receipt{:order="order_id"}receipt: :order is string, want quiet.Receipt
::receipt with no bindingreceipt: missing binding ":order"
:order with map[string]any datareceipt: :order is untyped data (order), want quiet.Receipt
::button{:label="first_name"} (Plain)button: unknown attribute ":label" (did you mean label?)

Plain binds no Go types, so its components take no bindings. More on paths and types in Bind structured values.

Write the content

Between the opener and the closer goes the component's content, and the schema's content says what it may be.

  • content: none takes nothing: footer: content is not allowed.
  • allow lists the Markdown blocks it takes, from paragraph, heading, list, actions (an action row), table and image. Anything else is <component>: <block> is not allowed here, as in notice: action row is not allowed here. Blockquotes, code blocks and --- rules are never allowed.
  • headings limits the levels: column: h1 is not allowed here.
  • Counts bound the paragraphs, the blocks or a table's columns: notice: 1 to 2 paragraphs, got 3, breakdown: table must have at most 2 columns, has 3 (a table rejected this way leaves Quiet's breakdown empty, so it also prints breakdown: expected a table).
  • max_kind caps one kind of block: Quiet's statement takes one heading (statement: at most one heading).
  • sequence fixes the blocks in order: Quiet's offer is a heading then a paragraph (offer: expected a heading then a paragraph), and its table components are exactly one table (breakdown: expected a table).

A component's content is also where its inline opt-ins apply: strikethrough, link titles and images standing alone in a paragraph. See Know what is rejected.

Nest children

A component with children in its schema holds other components, written with one more colon. Plain's columns takes two or three :::column:

plain/samples/receipt-free.md#L19-L29
::columns
:::column
### Billed to
{{customer.name}}, {{customer.email}}
:::

:::column
### Payment
{{card}}
:::
::
  • Only the named child is allowed inside: columns: only component column is allowed here, also for loose Markdown between the children.
  • The count is checked: columns: 2 to 3 column components, got 1.
  • A child may hold children of its own when its schema declares children, one more colon each level down (::::card inside :::column inside ::columns), at any depth up to the parser's 32. Each level is checked against its own schema, and an error inside a child names that child and its own line. A component inside any component without children is column: component columns is not allowed here.
  • A child's own schema applies to it as usual. Plain's column can also stand on its own at the top level, where it renders like a section.

Quiet's stories and products hold :::story and :::product tiles the same way.

Follow the order rules

A schema's must_follow names the components this one must come straight after. Quiet's image is a band under a hero, so it must directly follow a statement:

templates/field-notes.md
::statement{eyebrow="Field notes" tone="orange"}
# The first frost
::

::image{src="{{hero_image}}" alt="An orchard in the first frost" tone="warm"}
::

Anywhere else it is image must directly follow a statement. The rule applies to siblings: top-level components, or the children of one component.

Stay within the limits

:button and :link are built into the engine, but the kit can cap them:

  • Template-wide, limits in kit.yaml. Quiet allows one :button per template: a second is more than one :button in the template.
  • Per component, limits in component.yaml. Quiet's letter takes no :button at all (letter: :button is not allowed here), so loose Markdown can only hold :links.

Plain sets no limits. See Actions and spans.

Leave spacing to the kit

A component's padding comes from its schema's spacing, and can depend on its neighbours: Quiet's receipt sits closer under a figure than under a statement. A template has no way to set margins, and doesn't need one: reorder the components and the spacing follows.

375 px · mobile

Next steps

Copyright © 2026