Content components
Every content component a card can use, with its properties and an example.
Each component is an object with a type and the properties listed for it. Text and number properties may also hold a {{ }} template or a { "$bind": "…" } object; see Data, state and bindings. Every component also accepts the common properties.
heading
A heading.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
text | text | yes | The heading text. | |
level | "1" "2" "3" "4" | "2" | Size, 1 being the largest. |
{
"type": "heading",
"text": "Heading",
"level": "2"
}text
A run of plain text.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
value | text | yes | The text. | |
size | "xs" "sm" "md" "lg" "xl" | "md" | Text size. | |
tone | "default" "muted" "primary" "success" "warning" "danger" | "default" | Color. | |
weight | "normal" "medium" "bold" | "normal" | Weight. | |
align | "start" "center" "end" | Alignment. | ||
mono | boolean | Use the monospace face, for ids and codes. | ||
lines | number | Clamp to this many lines. |
{
"type": "text",
"value": "Some text"
}markdown
Formatted text written in Markdown. Raw HTML is not rendered.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
value | text | yes | Markdown source. |
{
"type": "markdown",
"value": "**Bold**, _italic_ and a [link](https://example.com)."
}badge
A small status label.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
label | text | yes | The label. | |
tone | "default" "muted" "primary" "success" "warning" "danger" | "default" | Color. | |
icon | icon name | Icon before the label. |
{
"type": "badge",
"label": "New",
"tone": "primary"
}icon
An icon from the built-in set.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
name | icon name | yes | Icon name. | |
size | "sm" "md" "lg" "xl" | "md" | Size. | |
tone | "default" "muted" "primary" "success" "warning" "danger" | "default" | Color. |
{
"type": "icon",
"name": "bell"
}alert
A callout for something the reader should notice.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
title | text | yes | Headline. | |
description | text | Detail under the headline. | ||
tone | "default" "success" "warning" "danger" | "default" | Severity. | |
icon | icon name | Icon override. |
{
"type": "alert",
"title": "Heads up",
"description": "Something needs your attention.",
"tone": "warning"
}link
A link that opens in a new tab.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
label | text | yes | Link text. | |
href | URL | yes | Where it goes. |
{
"type": "link",
"label": "Open",
"href": "https://example.com"
}code
A block of preformatted code or log output, with a copy button.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
value | text | yes | The code. | |
wrap | boolean | Wrap long lines. |
{
"type": "code",
"value": "curl https://example.com"
}time
A point in time, kept current while the card is on screen.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
value | any JSON | yes | ISO date or millisecond timestamp. | |
format | "relative" "date" "time" "datetime" | "relative" | How to show it. | |
tone | "default" "muted" "primary" "success" "warning" "danger" | "muted" | Color. |
{
"type": "time",
"value": "{{now()}}",
"format": "relative"
}