Text components for widgets
Reference for the heading, text, caption and code components in the widget builder, with every property and an example of each.
Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.
Text components show words in a widget: titles, explanations, small notes and values the customer may copy. Every text property accepts bindings such as {{states.order.number}}, so the words can come from loaded data.
Components
| Type | Use it for |
|---|---|
heading |
A title at the top of a widget or a section. |
text |
Body copy. Supports bold, italic and links written in Markdown. |
caption |
Small supporting text, such as a date or a footnote. |
code |
A value the customer may copy, such as a tracking number or a voucher code. |
Properties
| Property | Applies to | Description |
|---|---|---|
text |
All | The words to show. Required. |
level |
heading |
1, 2 or 3. Smaller numbers are larger. Default 2. |
tone |
text |
default, muted, success, warning or danger. Changes the color and weight. |
showIf |
All | A binding. The component appears only when the value is true or non-empty. |
Example
{
"type": "stack",
"children": [
{ "type": "heading", "text": "Order {{states.order.number}}", "level": 2 },
{ "type": "text", "text": "Your parcel is **on its way**.", "tone": "success" },
{ "type": "code", "text": "{{states.order.trackingCode}}" },
{ "type": "caption", "text": "Last updated {{states.order.updatedAt}}" }
]
}
You should see a heading, a green line of text, a copyable code and a small caption, stacked in that order.
Tips
- Use one
headingper widget. A second title usually belongs in its own card. - Keep
textto a few short lines. Long explanations belong in the agent's answer, not in the widget. - Use
toneto match meaning, not decoration:successfor good news,warningfor something that needs attention,dangerfor failures. - Hide empty lines with
showIfinstead of showing a label with no value.
Note: Text is plain by design. To style a group of components, wrap them in a layout component such as
card.
Related pages
- Data display shows lists, tables and status values.
- States explains the values you can bind.
- Widgets overview lists every component group.