Components
Media components
Every media 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.
image
An image from a URL, or a file sent with the card as {{files.name}}.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
src | URL | yes | Image address. | |
alt | text | Description for screen readers. | ||
aspect | "auto" "square" "video" "wide" "portrait" | "auto" | Crop to a fixed shape. | |
fit | "cover" "contain" | "cover" | How the image fills its box. | |
rounded | "none" "md" "full" | "md" | Corner rounding. | |
zoom | boolean | Open full size when tapped. |
{
"type": "image",
"src": "https://picsum.photos/seed/hookboard/640/360",
"alt": "Example",
"aspect": "video"
}avatar
A round picture with a text fallback.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
src | URL | Picture address. | ||
name | text | yes | Name; its initials show when there is no picture. | |
size | "sm" "md" "lg" | "md" | Size. |
{
"type": "avatar",
"name": "Ada Lovelace"
}video
A video player.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
src | URL | yes | Video address. | |
poster | URL | Image shown before playing. |
{
"type": "video",
"src": "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"
}audio
An audio player.
Does not take children.
| Property | Type | Required | Default | What it does |
|---|---|---|---|---|
src | URL | yes | Audio address. |
{
"type": "audio",
"src": "https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3"
}