The card file
Parts and layout
The building blocks a card is drawn from, and how they fit together.
A card is a tree of parts. Every part is an object with exactly one kind key (text, stat, button…) whose value is the part’s main value, plus props. Containers (row, column, grid) hold other parts. Everything below comes from the catalogue, so it matches what TailApps draws.
{ "stat": "$mrr | currency", "label": "MRR", "size": "xl" }
On this page: cards · containers · props on any part · parts · tokens
Cards
{ "id": "main", "layout": <part>, "footer": <part>?, "params": {…}?, "toolbar": [...]? }. Views show cards by id. The optional footer sits under the layout after a hairline; buttons there show their keycaps. "params": { "id": "text" } (arg types) makes it a detail card: it only opens from an open_card step, which gives them, and reads them as $params.id; views and tabs can't show it. "toolbar": 1 to 3 icon buttons at the card's top right (the iPhone's navigation bar), each { "label", "icon" (SF Symbols), "on", "args"?, "style": "destructive"? }; the label is the tooltip and what VoiceOver reads (SPEC §65.7).
{
"id": "main",
"layout": {
"column": [
{
"stat": "$mrr | currency",
"label": "MRR"
},
{
"button": "Refresh",
"on": "refresh",
"style": "plain"
}
],
"gap": "m"
}
}
Detail
{
"id": "detail",
"params": {
"id": "text"
},
"toolbar": [
{
"label": "Delete",
"icon": "trash",
"on": "remove",
"args": {
"id": "$params.id"
},
"style": "destructive"
}
],
"layout": {
"text": "$params.id",
"size": "l"
}
}
Containers
At most 4 nested containers (row, column, grid and list item templates each count as one).
Children side by side
| gap | Space between children: xs, s, m, l |
| align | Cross-axis alignment: start, center, end, stretch |
| justify | Main-axis distribution: start, center, end, between |
| wrap | Row only: wrap children onto new lines (bool) |
| overlap | Row only: children overlap slightly, for a stack of avatars (bool) |
| limit | Row with overlap only: show this many, then +N |
{
"row": [
{
"text": "Left"
},
{
"spacer": true
},
{
"badge": "Right"
}
],
"align": "center"
}
Children stacked
| gap | Space between children: xs, s, m, l |
| align | Cross-axis alignment: start, center, end, stretch |
| justify | Main-axis distribution: start, center, end, between |
| style | Column only: inset = one rounded group, hairlines between parts; a list inside adds its rows to the group. tile = a rounded tile filled with hue (default: the accent), its parts drawn light on it: coloured cards in a list (timers, rooms, projects) |
| hue | Column with style tile only: the tile's fill, a hue token or binding like "$item.hue" |
{
"column": [
{
"text": "One"
},
{
"text": "Two"
}
],
"gap": "m"
}
Children in equal columns; span: N on a child takes N cells. Buttons fill their cell, so a grid of buttons is a keypad
| gap | Space between children: xs, s, m, l |
| align | Cross-axis alignment: start, center, end, stretch |
| justify | Main-axis distribution: start, center, end, between |
| columns | Grid only: a number (1–6), "auto:s" (min column width token), or { "default": 3, "narrow": 1, "wide": 4 } |
{
"grid": [
{
"stat": "$a",
"label": "A"
},
{
"stat": "$b",
"label": "B"
}
],
"columns": {
"default": 3,
"narrow": 1
}
}
Props on any part
| when | Binding; the part is hidden when falsy |
| grow | true: takes spare space in a row |
| span | Grid child: number of columns to span |
| platforms | ["macos"] or ["ios"]: the part shows only there (default: everywhere). For one or two parts; when a card fills up with them, give the phone its own card with views.phone |
| context_menu | Actions on a right-click (Mac) or long press (iPhone): [{ "label": "Copy link", "icon": "link", "on": "copy", "args": { … }, "style": "destructive" }], 1–12 items. In a list's item template it's per row, with $item |
| drag | Mac: drag the part out of the card into Finder or any app, as a copy: a file the app may read ("$item.path": its captures, files dropped or picked for it, or in a folder the user chose), several ({ "files": "$tray" }, up to 100) or { "text": "$item.text" } |
| on_dragged | with drag: action run once a receiver takes the copy (not for a drag let go over nothing), with $args.item (the row's item, else what was dragged), e.g. to clear a tray |
Parts
text · stat · badge · image · gallery · avatar · message · icon · progress · gauge · timer · heatmap · calendar · steps · map · code · qr · section · menu · list · table · player · chart · button · field · checklist · link · divider · spacer · cell · tabs · drop · canvas
Text
| text | Main value: text or binding |
| size | token, or xxl: display digits (48 pt on Mac) on one line that shrink to fit, or fill: one line as big as the space allows (grows with a pop-out window) |
| tone | token |
| emphasis | token |
| lines | max lines (1–20) |
| mono | bool |
| markdown | bool: inline Markdown (bold, italic, code, strike, links that need open:url) and inline icons {icon:name} or {icon:name:hue} |
{
"text": "Updated {$meta.deploys.updated | ago}",
"size": "s",
"emphasis": "subtle"
}
A big number with a label
| stat | Main value: value binding |
| label | text |
| size | token (default l), or xxl: display digits that shrink to fit, or fill: as big as the space allows |
| tone | token |
| hue | hue token (a categorical colour, for what isn't good or bad) |
{
"stat": "$mrr | currency",
"label": "MRR",
"size": "xl"
}
A small coloured label
| badge | Main value: text or binding |
| tone | token |
| hue | hue token (a categorical colour, for what isn't good or bad) |
| busy | bool or binding: a small turning ring before the text while something is working, e.g. "$running.deploy" or "$job.state | map:{running:true, else:false}" |
{
"badge": "$status | map:{ok:'Up', else:'Down'}",
"tone": "$status | tone:{ok:'good', else:'bad'}"
}
One image: a local file (screenshots, saved files), one of the app's own files ("assets/logo.png", sent in create_app files), or an https URL on a host declared as net:<host> (at most 5 MB, no cookies or keys, not in show_ui). GIF, animated PNG and animated WebP play while on screen (not under Reduce Motion or Low Power Mode)
| image | Main value: local file path, assets/<name>, or https URL (binding) |
| height | size token |
| fit | fit | fill |
| width | size token: a fixed width (default: as wide as the picture at this height) |
| shape | rounded | circle (a round crop, height across) |
| alt | text screen readers say; without it the image is decoration |
| on_select | action name; it gets $args.image (the path or URL shown) |
| preview | bool: a click shows it larger (not with on_select) |
{
"image": "assets/logo.gif",
"height": "m",
"alt": "Logo",
"preview": true
}
Thumbnails of images (local paths, assets/<name> or https URLs, as on image), in a grid that wraps
| gallery | Main value: list binding: image paths, or objects with an image path (see image) |
| limit | max items |
| height | size token |
| on_select | action name; it gets $args.item (the whole item) |
| thumb | each item's image path when items are objects, e.g. "$item.thumb" (default: the item itself). Lets a shot keep its link: push { thumb, url } and copy $args.item.url on select |
| preview | bool: a click shows that image larger (not with on_select) |
| selected | rings the picked picture, as on cell: { "value": "$item.id", "is": "$bg" } (with on_select setting $bg) |
{
"gallery": "$shots",
"limit": 3,
"thumb": "$item.thumb",
"on_select": "copy_shot"
}
A round picture of someone: their image, else initials on a hue from their name
| avatar | Main value: local image path or https URL (binding; see image), or null for initials only |
| name | text: the initials, and what screen readers say. Required without an image |
| size | token |
| hue | hue token (default: a stable hue from name) |
| status | tone token: a small dot |
{
"avatar": null,
"name": "$item.name",
"status": "$item.online | map:{true:'good', else:'neutral'}"
}
One message in a conversation: a bubble aligned by from. Use as a list's item with scroll: end. Plain text, or inline Markdown and icons with markdown: true; web addresses become links in an app that holds open:url. Bound text's links must show their own address. With style: note it is a note instead: full width on a soft fill, with an optional title, for notes, journals and comments
| message | Main value: text or binding |
| from | me | them | system (default them; may be a binding) |
| name | text, shown over messages that aren't yours |
| avatar | image path or https URL (see image), or null for initials from name |
| media | a picture in the bubble (see image: local path, assets/<name> or https URL; GIFs play), or null. A click shows it larger. With media, message may be "" or null for no caption |
| time | text or binding, e.g. "$item.at | ago" |
| status | text, e.g. sent |
| tone | tone token, tints the bubble |
| markdown | bool: inline Markdown and {icon:name:hue}, as on text; lines starting #, - , 1. , - [ ] or > draw as headings, bullets, numbered items, tick-box lines and quotes |
| style | bubble (default) | note |
| title | note only: a bold line over the text |
| lines | show at most this many lines (1–40), e.g. 3 for a note's preview |
| hue | note only: hue token that tints the note (tone works too) |
| on | note only: action a click on the note runs, e.g. open it to edit |
| args | note only, with on: the action's args |
{
"message": "$item.text",
"from": "$item.mine | map:{true:'me', else:'them'}",
"name": "$item.sender",
"avatar": null,
"time": "$item.at | ago"
}
An SF Symbols name or one emoji. An unknown name shows a plain circle
| icon | Main value: name or emoji (binding) |
| size | token |
| tone | token |
| hue | hue token |
{
"icon": "checkmark.seal",
"tone": "good"
}
How far through something, as a bar, ring or row of ticks, in equal pieces with split; or parts of a whole (a breakdown) on a bar or a ring
| progress | Main value: 0…1 number (binding), null for indeterminate, or a list of { value, hue, label } for a breakdown |
| label | text |
| tone | token |
| style | bar | ring | segmented (a breakdown: bar, segmented or ring, a donut) |
| size | token (ring diameter, segmented height, bar thickness) |
| scale | 2–5 hues coloured by position, e.g. ["red", "yellow", "green"]; wins over tone |
| max | breakdown only: the whole (default: the sum) |
| from | a time: progress is then an end time, and it fills by itself from from to it, live |
| percent | bool: write the share out (42%): beside the bar, inside the ring, after each legend label of a breakdown |
| split | 2–50 or a binding ("$todos | count"): a bar or ring in that many equal pieces, e.g. 3 of 5 steps |
{
"progress": "$item.done",
"label": "Uploading",
"style": "bar"
}
How full or how hot: a half ring, or a dial of ticks; or where a value sits in a range, as a dot on a line
| gauge | Main value: number (binding) |
| min | number or binding (default 0) |
| max | number or binding (default 1) |
| label | text |
| tone | token, often a binding with thresholds |
| size | token |
| style | arc | ticks | line (a flat track with a dot at the value and no number: where something is in a range, like the time of day) |
| scale | 2–5 hues coloured by position, e.g. ["blue", "green", "yellow"]; wins over tone |
| unit | text drawn small after the number (default % for the 0–1 range) |
| band | line only: [from, to] (numbers or bindings), a stretch of the track drawn stronger, e.g. working hours [9, 18] on min 0 max 24; from above to wraps round the end |
{
"gauge": "$item.cpu",
"label": "CPU",
"tone": "$item.cpu | tone:{good:'<0.7', else:'bad'}"
}
A live clock: time since something (counting up) or until it (counting down), redrawn every second while it shows. It never writes state or re-runs sources
| timer | Main value: a time: unix seconds or milliseconds, or ISO text (binding). Null shows a dash |
| mode | since (default, counts up) | until (counts down, stops at 0) |
| format | clock (default: 4:05, 01:12:05) | short (12m, 1h 12m) |
| on_end | action run once when an until countdown reaches 0, whether or not the card shows (Mac; not inside a list template). For an alarm that rings with the app closed, schedule a notify with at |
| tone | token or binding |
| size | token, or xxl: display digits that shrink to fit, or fill: as big as the space allows |
{
"timer": "$item.started_at",
"format": "short"
}
A grid of days, one column per week, darker for higher values: habits, commits, sales by day. The newest week is on the right
| heatmap | Main value: list binding of { date, value } (date unix or ISO; value a number, or true/false; no value counts 1). Several items on one day add up |
| days | how many days back (7–371, default 91) |
| max | number or binding: the value that draws darkest (default: the highest shown) |
| hue | hue token (default: the app accent) |
| start | monday | sunday (default: the device's week start) |
| on_select | action run when a day is clicked: gets $args.date (unix seconds, the day's start) and $args.value |
{
"heatmap": "$daily",
"days": 91,
"hue": "green"
}
Events on a month grid, as an agenda (the next days, a row per event; fits a menu-bar card), on a day or week of hours with events as blocks placed by time, or as a year of 12 small months with each day shaded by how many events it has. The user moves with ‹ › and Today, and switches between 'views', which change only what shows, never state. The app sends the events (a calendar source's list as it is)
| calendar | Main value: list binding of events { start, end?, title?, hue?, all_day?, location?, note? } (times unix or ISO; note may be notes or description; a date with no time, or a { date, label?, hue? } entry, is all day; an all-day end is the day after the last day) |
| view | month (default) | agenda | day | week | year, or a binding to one |
| views | list of two or more views the user can switch between, e.g. ["agenda", "week", "month"]: a segmented control; the user's pick is remembered per app |
| date | binding: the day in focus (default: today); ‹ › move by a month, by 'days' in agenda, a day, a week, or a year |
| days | agenda: how many days to show (1–60, default 7) |
| hours | day and week: { "from": 8, "to": 20 } (default), whole hours; events outside show pinned to the top or bottom edge |
| work_week | week: true shows only the days that aren't the weekend (Monday to Friday in most places) |
| limit | agenda: most events shown (1–200, default 20) |
| marks | month: dot (default) | fill |
| hue | hue token for events without their own hue (default: the app's accent) |
| on_select | agenda, day and week: action run for an event; it gets $args.item (the event as the app sent it) |
| quick | true (default) opens a small popover with the event's time, location and note, and an on_select button; false runs on_select straight away |
| select_label | text of the popover's on_select button (default "Open") |
| on_day | month and year: action run when a day is clicked (in year a month's name opens that month when views has month, and so does a day when there's no on_day); day and week: when an empty hour is clicked. Gets $args.date (unix seconds: the day's or the hour's start) and $args.items (that day's events) |
{
"calendar": "$meetings",
"views": [
"agenda",
"week",
"month"
],
"hours": {
"from": 9,
"to": 18
},
"on_select": "join",
"select_label": "Join"
}
Steps in order with a state each: CI jobs, a deal or hiring stage, onboarding. Vertical by default; horizontal turns vertical when it doesn't fit
| steps | Main value: list binding: one item per step |
| label | template using $item: each step's name (default: $item.label, $item.name or $item.title; or the item when it's text) |
| state | template using $item that gives done | active | failed | skipped | pending (default: $item.state; anything else shows as pending). Map other words with the map formatter, e.g. "$item.conclusion | map:{success:'done', failure:'failed', else:'pending'}" |
| note | template using $item: a smaller line under the step, e.g. a duration (default: $item.note) |
| direction | vertical (default) | horizontal |
| on_select | action name; it gets $args.item (the whole step) |
{
"steps": "$jobs",
"label": "$item.name",
"state": "$item.result | map:{passed:'done', failed:'failed', running:'active', else:'pending'}",
"direction": "horizontal"
}
A map with markers and an optional route line (Apple Maps). No permission: it only draws the places it's given and never reads where the device is
| map | Main value: list binding of markers { lat, lng, label?, icon?, hue? } (icon: an SF Symbols name; hue: a hue token) |
| height | size token (default l) |
| center | { lat, lng } (numbers or bindings), or a binding to such a place, to centre on (default: fit every marker and the route, following new positions until the user moves the map) |
| radius | km from center to the map's edge (0.05–10000, default 2.5) |
| route | list binding of { lat, lng }: drawn as a line in order, e.g. a delivery's path |
| on_select | action name; it gets $args.item (the clicked marker) |
{
"map": "$drivers",
"height": "l",
"route": "$path"
}
A block of fixed-width text: selectable, not wrapped
| code | Main value: text or binding |
| lang | hint only, not highlighted |
| diff | bool: colours + and - lines |
| lines | max lines before it scrolls |
| copy | bool, default true: a copy button. It copies the whole text, and reads Copy all N lines when lines are hidden |
{
"code": "$item.log",
"lines": 8
}
A QR code, made on this device
| qr | Main value: text or binding |
| size | size token |
| label | text |
{
"qr": "$item.link",
"label": "Scan to open"
}
A titled block of parts, optionally collapsible. Counts toward the 4-deep nesting limit
| section | Main value: title text |
| children | array of parts (required) |
| collapsible | bool |
| collapsed | bool or binding: starts closed; the user's choice is remembered per app |
| trailing | one part on the title row, like a badge or button |
{
"section": "Details",
"collapsible": true,
"children": [
{
"text": "$item.note"
}
],
"trailing": {
"badge": "$item.count"
}
}
Repeats a part template for each element
| list | Main value: list binding |
| item | part template using $item and $index (required) |
| limit | max items |
| empty | text when the list is empty |
| scroll | end: start at the last row, and stay there as rows arrive if already at the bottom; limit then keeps the last rows. For lists kept oldest first |
| height | fill: take the window's height in a pop-out; elsewhere the usual cap applies |
| group | template for a section key, using $item: a header row appears whenever it changes |
| style | timeline: each row gets a dot and a line down to the next, for schedules and activity feeds |
| swipe | row actions: { "leading": [{ "label": "Done", "icon": "checkmark", "hue": "green", "on": "complete" }], "trailing": [{ "label": "Delete", "icon": "trash", "style": "destructive", "on": "remove" }] }, up to 3 a side. Each action gets $args.item and $args.index (its place in the whole list) without declaring them, plus its own args; use match on an id to change or remove it. A sideways swipe on iPhone; on the Mac (and for VoiceOver) the same actions are in the row's right-click menu |
| refresh | a source name: on iPhone, pulling the card down refreshes it (the Mac has ⋯ › Refresh) |
{
"list": "$deploys",
"limit": 5,
"empty": "No deploys",
"item": {
"row": [
{
"text": "$item.name",
"grow": true
},
{
"badge": "$item.status"
}
]
}
}
Rows and text columns (no buttons; use a list of rows for per-row buttons)
| table | Main value: list binding |
| columns | [{ "label": "Port", "value": "$item.port", "mono": true }] (required) |
| limit | max rows |
| empty | text when the list is empty |
{
"table": "$ports",
"columns": [
{
"label": "Port",
"value": "$item.port",
"mono": true
},
{
"label": "Process",
"value": "$item.command"
}
]
}
Plays a video or audio file with the system's controls (nothing plays until the user presses play). A file that's gone (temporary files last a day) shows "This clip is gone". On the Mac, "camera" shows the camera live instead (nothing recorded; needs the camera permission): a card that's just a round one pops out as a round camera bubble that screen recordings keep in
| player | Main value: a file path a step gave, usually "$clip.path" from camera.take, or a received file; or "camera" / "camera:<name>" for this Mac's camera, live |
| height | size token (default l) |
| shape | rounded (default) or circle; live camera only |
{
"player": "$path",
"height": "l"
}
A small chart
| chart | Main value: list of numbers or [{label, value}] |
| kind | bar | line | spark (no axes, small, fits in a row beside a stat) |
| height | size token |
| tone | token |
| hue | hue token (a categorical colour, for what isn't good or bad) |
{
"chart": "$daily",
"kind": "bar"
}
A native input (§42) bound to state or $ui, or showing a value with on_change
| field | Main value: label |
| type | text | search | textarea | number | stepper | toggle | slider | select | segmented | date | time | color. Stores: text, number, true/false, the option's value, unix seconds (date), "HH:MM" (time), a hue name (color) |
| bind | state key like "$query" or "$ui.name" (this or value) |
| value | apps: a binding the field shows but doesn't write, e.g. "$sound.volume"; needs on_change |
| on_change | action run when the user changes it, with $args.value and $args.previous (undeclared). Slider: on release, or while dragging with live; text: 0.5 s after typing stops. Not in show_ui |
| disabled | binding |
| options | select and segmented: strings, or { label, value, icon? } (icon: segmented), or a binding |
| min | slider (required), stepper, date (unix seconds or a binding) |
| max | same as min |
| step | slider, stepper (default 1) |
| time | date: bool, also pick a time |
| style | toggle: switch (default) | checkbox (the Mac's own; a square tick box on iPhone) | check (a round tick box everywhere); date: compact (default) | graphical |
| live | slider: run on_change while dragging |
| format | slider, stepper: one formatter for the shown value, e.g. "percent" |
| unit | slider, stepper: text after the number, e.g. "°C" |
| placeholder | text |
| on_submit | text, search, textarea: action with no args run by Return (⌘Return in a textarea). Skipped while it's running |
{
"field": "Volume",
"type": "slider",
"value": "$sound.volume",
"min": 0,
"max": 100,
"unit": "%",
"on_change": "set_volume"
}
Tickable rows; bind receives the ticked values
| checklist | Main value: list binding |
| label | template per row |
| bind | where ticked values go (required) |
| value | template for each stored value |
| note | template, e.g. a warning |
| default_checked | binding or bool per row |
{
"checklist": "$pending",
"label": "$item.name",
"value": "$item.name",
"bind": "$ui.selected"
}
Opens a web or mail link (https://, http://, mailto:; needs open:url)
| link | Main value: label |
| url | URL binding (required) |
{
"link": "Open dashboard",
"url": "https://cloud.laravel.com"
}
A horizontal rule
| divider | Main value: true |
{
"divider": true
}
Flexible space in a row
| spacer | Main value: true |
{
"spacer": true
}
A ready-made row (icon, title, subtitle, status dot, count, chevron); use it instead of hand-built rows. With check and on_check it is a to-do row
| cell | Main value: title text |
| subtitle | text under the title, muted |
| leading | an SF Symbols name (accent colour), or one part like { "icon": "wifi", "hue": "green" } or { "avatar": … } |
| trailing | text, or one part at the end: a badge, a button, a row of buttons, a menu, a toggle field (its label is hidden: the title says it) |
| status | tone token: a small dot (good, warn, bad, accent, neutral) |
| count | number or binding: a small count capsule, hidden at 0 |
| accessory | chevron | check | none (default) |
| selected | bool or binding: drawn picked, in the accent fill; or { "value": "$item.id", "is": "$picked" }: picked when the two are equal (set $picked in the cell's on action) |
| on | action a click on the row runs |
| args | with on: the action's args |
| confirm | with on: confirmation text |
| check | bool or binding: a tick box at the start of the row, e.g. "$item.done". Ticked, the title is struck through and muted |
| on_check | action a tick runs, with $args.value (the new true or false, undeclared) and the cell's args, e.g. an update step that sets done |
| check_hue | hue token for the tick box (default: the app accent) |
| check_style | round (default) | square |
{
"cell": "$item.name",
"subtitle": "Port {$item.port}",
"leading": "globe",
"status": "good",
"accessory": "chevron",
"on": "kill",
"args": {
"port": "$item.port"
}
}
Tabs inside a card: a segmented control over the parts of the picked tab. The pick is remembered per app. For a card with two or three views of the same data (Open / Mine, Today / Done)
| tabs | Main value: array of 2–6 tabs: { "label": "Today", "icon": "sun.max", "count": "$todos | count", "when": binding, "children": [parts] }; count shows beside the label (hidden at 0); a tab hidden by when can't be picked. Children count one level of nesting, as a section's do |
| style | segmented (default) | underline: the labels in a row, the picked one underlined in the accent |
{
"tabs": [
{
"label": "Deploys",
"icon": "shippingbox",
"children": [
{
"list": "$deploys",
"item": {
"cell": "$item.name"
}
}
]
},
{
"label": "Jobs",
"count": "$jobs | count",
"children": [
{
"list": "$jobs",
"item": {
"cell": "$item.name"
}
}
]
}
]
}
Files in (§51): drop files on it, or click (tap on iPhone) to choose. Its action gets $args.files: [{ path, name, base, ext, kind, type, size, modified }]. No permission: the drop is the approval. Draws its own drag-over, working, done and error states
| drop | Main value: label, e.g. "Drop images to convert" |
| on | action run with $args.files (required) |
| args | the action's own declared args, as on a button |
| accept | list of kinds (image, video, audio, pdf, text, json, csv, archive), extensions like ".heic", or type identifiers like "public.json"; default any file |
| multiple | bool: take several files at once (default one) |
| max | with multiple: most files at once (default 20, at most 100) |
| max_mb | skip files bigger than this many MB |
| hint | muted line under the label, e.g. "PNG, JPG or HEIC" (default: what accept takes) |
| icon | SF Symbols name (default from accept) |
| size | s (one slim row) | m (default) | l (a big target) |
| disabled | binding |
{
"drop": "Drop images to convert",
"accept": [
"image"
],
"multiple": true,
"hint": "PNG, JPG, HEIC or TIFF",
"on": "convert"
}
The person draws (§47.2, §60.11, §60.13e), the app never does: a signature, a sketch, or marking up a screenshot (arrows, boxes, hiding a part with a solid block). Draws in place on the Mac with a tool row (undo, redo, clear); on iPhone a tap opens it full screen. Each change is saved a moment after the last stroke: the bound state key gets { path (the PNG, with the picture under it), items, width, height, count, empty, at }, then on_change runs. $sketch.path is empty until something is drawn
| canvas | Main value: the canvas's id (kebab-case), e.g. "markup": names its files and canvas.clear |
| bind | object state key for what's drawn (required), e.g. "$sketch" declared { "type": "object", "default": {} } |
| height | m (default) | l | fill (a pop-out's height) |
| background | blank (default, white) | grid | lines | dots | an assets/ picture | a binding to a picture to mark up, like "$shot". Another picture starts a new drawing: run canvas.clear in the step that changes it |
| tools | list from pen, marker, eraser, arrow, line, rect, ellipse, redact (a solid block that hides what's under it in the saved PNG); default ["pen", "eraser"] |
| tones | ink colours from red, orange, yellow, green, blue, purple, pink, black, white; default red, yellow, green, blue, black, white |
| on_change | action run after each saved change, with $args.value (the state value) |
| readonly | bool: shows the drawing without tools |
{
"canvas": "markup",
"bind": "$marked",
"background": "$shot",
"tools": [
"pen",
"arrow",
"rect",
"redact",
"eraser"
],
"height": "l",
"on_change": "render"
}
Tokens
Cards have no pixel sizes or colours. These tokens are the whole styling vocabulary, so a card looks right on every device, at every width, in light and dark. The only colour a card picks is style.accent.
| tone | good, warn, bad, accent, neutral |
| hue | red, orange, yellow, green, mint, teal, cyan, blue, indigo, purple, pink, brown, gray |
| size | xs, s, m, l, xl |
| emphasis | subtle, normal, strong |
| gap | xs, s, m, l |
| align | start, center, end, stretch |
| justify | start, center, end, between |
| width | narrow, default, wide |
| density | compact, comfortable |
tone, size and emphasis may also be bindings: "tone": "$change | tone". Widths: narrow = popovers (≈340 pt), default = floating panels (≥420 pt), wide = panels ≥720 pt.