Layout components
Every layout 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.
stack
Lays children out in a column or a row.
Holds other elements in children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
direction | "column" "row" | "column" | Which way children flow. | |
gap | "none" "xs" "sm" "md" "lg" "xl" | "md" | Space between children. | |
align | "start" "center" "end" "stretch" "baseline" | Cross-axis alignment. | ||
justify | "start" "center" "end" "between" | Main-axis distribution. | ||
wrap | boolean | Let a row wrap onto more lines. |
{
"type": "stack",
"gap": "md",
"children": []
}grid
Places children in equal columns. Collapses to fewer columns on narrow screens.
Holds other elements in children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
columns | number | 2 | Number of columns, 1 to 6. | |
gap | "none" "xs" "sm" "md" "lg" "xl" | "md" | Space between cells. | |
align | "start" "center" "end" | Where a child shorter than its row sits in its cell: at the top (start), the middle or the bottom. Top when left out. |
{
"type": "grid",
"columns": 2,
"children": []
}section
A titled group of content.
Holds other elements in children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
title | text | Heading. | ||
description | text | Supporting line under the heading. |
{
"type": "section",
"title": "Section",
"children": []
}panel
A bordered container that sets content apart inside a card.
Holds other elements in children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
tone | "default" "muted" "primary" "success" "warning" "danger" | "default" | Background tint. | |
padding | "none" "sm" "md" "lg" | "md" | Inner spacing. |
{
"type": "panel",
"children": []
}tabs
Switches between tab panels. Children must be tab elements.
Its children must all be tab elements.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
bind | state path | State path holding the open tab's value. Optional. | ||
defaultValue | text | Value of the tab open at first. |
{
"type": "tabs",
"children": [
{
"type": "tab",
"label": "First",
"value": "first",
"children": []
},
{
"type": "tab",
"label": "Second",
"value": "second",
"children": []
}
]
}tab
One panel inside tabs.
Only valid directly inside tabs.
Holds other elements in children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
label | text | yes | Tab label. | |
value | text | Identifier for this tab. Defaults to the label. |
accordion
Collapsible sections. Children must be accordionItem elements.
Its children must all be accordionItem elements.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
multiple | boolean | Allow several sections open at once. |
{
"type": "accordion",
"children": [
{
"type": "accordionItem",
"title": "Details",
"children": []
}
]
}accordionItem
One collapsible section inside an accordion.
Only valid directly inside accordion.
Holds other elements in children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
title | text | yes | Section heading. | |
open | boolean | Open at first. |
scroll
A fixed-height area that scrolls its content.
Holds other elements in children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
height | number | 240 | Height in pixels. |
{
"type": "scroll",
"height": 240,
"children": []
}separator
A dividing line.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
label | text | Optional text centered on the line. |
{
"type": "separator"
}spacer
Empty space. In a row it pushes siblings apart.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
size | "none" "xs" "sm" "md" "lg" "xl" | Fixed size. Leave empty to fill the free space. |
{
"type": "spacer"
}