The authoring guide for a model that answers with UI. Give it to the model as
reference material (a system-prompt section, a skill, or the result of a
"read the docs" tool) alongside the show_ui tool. The tool's own
description (showUiToolDescription()) documents the common components
inline; this is the whole catalog and the rules for using it well.
A view is JSON naming components from a fixed catalog, laid out as a tree. It draws in the host app's theme, light and dark, by itself. There are no colours, class names, styles or code in it: tones and sizes are fixed choices, and anything not in the catalog cannot be drawn.
{
"root": "page",
"elements": {
"page": { "type": "Stack", "props": {}, "children": ["numbers", "table"] },
"numbers": { "type": "Grid", "props": { "columns": 2 }, "children": ["open", "value"] },
"open": { "type": "Metric", "props": { "label": "Open deals", "value": 128 } },
"value": { "type": "Metric", "props": { "label": "Pipeline", "value": 1280000, "format": "compact", "prefix": "€" } },
"table": {
"type": "DataTable",
"props": {
"rows": [
{ "company": "Northwind", "stage": "Proposal", "amount": 48000 },
{ "company": "Globex", "stage": "Qualified", "amount": 31000 }
],
"columns": ["company", "stage", "amount"],
"cells": { "amount": { "format": "number", "prefix": "€" } }
}
}
}
}rootnames the top element;elementsmaps an id to{ type, props, children? }. Ids are yours (short, descriptive); every child id must exist and have one parent.- Limits: 40 elements, 6 levels deep, 24 children per element.
- A call with problems comes back with issues, each naming where it is. Fix them and call again.
When the host gives earlier results a reference (a tool call id, a query's
ref), bind a prop to it with { "$data": "<ref>" } instead of retyping the
rows. Only props marked bindable below take a binding, and the host decides
what a ref may name.
- Bind
DataTable.rowsandChart.datato whole rows; use the component's owncolumns/x/y. { "$data": "<ref>", "column": "Company" }selects a list of values, forList.rowsorSpark.values. It is still a list, never a single value forMetric.value.- Other values may be inline: totals and counts computed by a tool, and drafts you write. Never add up rows in your head; ask a tool for the aggregate.
Props marked bindable take a binding. Tones: neutral, accent, success, warning, danger. Gaps: sm, md, lg.
| Component | Props | Children |
|---|---|---|
Stack |
direction (vertical default, horizontal), gap |
any |
Grid |
columns (1–4; wraps to one column when narrow), gap |
any |
Split |
side (which child is the narrow rail: end default, start) |
exactly two, usually Stacks: the main column and the rail |
Card |
title, description, tone (marks the panel in its colour; for the one panel the reader must not miss), badge and badgeTone (a short status on the title's line), footer (one quiet line at the foot: when it was updated, where it comes from), image and imageAlt (a picture across its head; an upload, as for Image), maxHeight (sm, md, lg: caps how tall its content grows; past it the content fades out above a "Show more" button. Give every card of a gallery the same one) |
any |
Tabs |
— | only Tabs |
Tab |
label |
any |
Disclosure |
title, defaultOpen |
any |
Divider |
— | — |
| Component | Props |
|---|---|
PageHeader |
title, subtitle (one line: a category, an owner, a date). Nothing beside it: a status that is news goes in the summary; one that truly belongs by the title is a Badge beside it in a horizontal Stack. For a person or a company, use Profile |
Heading |
text, level (1–3, default 2) |
Text |
text (bindable), muted. Inside the text, **bold**, *italic*, `code` and [a link](https://…) are formatted; nothing else of Markdown is (no headings, lists or images; for those use Markdown), and \* keeps a mark literal. Bold is for the one phrase the reader must not miss |
Markdown |
text (bindable): Markdown with structure of its own — paragraphs, **bold**, *italic*, lists, ### headings, > quotes, tables, `code`, http(s) links. A single line break is kept, so lines of data joined by \n read as lines. Pictures and HTML are not drawn. For a menu, a note, instructions, a description read off a page; one paragraph is a Text, items of data a List |
Statement |
lead (the point, one short sentence, full ink), text (why, or what it means, quiet ink), size (body in a panel, large by default to open a view or section, display once per page). Plain text. Use it for the overview at the top of a view: the lead alone should carry the news |
Code |
text (bindable), language (a short word: sql, json, bash), title (what it is: a file name, "Query"). Code, a command or a config exactly as written, with a copy button; not coloured by syntax |
Callout |
text, title, tone |
Badge |
text, tone |
Chip |
text (bindable), one of icon / avatar (a name, shown as initials), tone (colours the icon, or adds a dot), url (makes it open that address). A thing referred to: a person, a date, a document, a tag. For a state ("Won", "At risk") use a Badge |
Image |
src (an uploaded file, written upload:<id>; web addresses are refused), alt (required: what it shows), caption, ratio (wide, square, portrait: crops it to that frame; left out, it keeps its own shape). Use only an upload id you were given; never invent one |
Icon |
name (one of the icons listed under the table), label (what it means, for readers who cannot see it), tone, size (sm, md, lg) |
Avatar |
name (bindable; shown as initials), kind (person default, company), size |
AvatarGroup |
names (bindable; overlapping initials), max (default 4; the rest show as "+3"), size |
Row |
title, detail, value (all bindable), one of icon / avatar (a name) / lead (a short text such as a time), badge and badgeTone, url. One line about one thing; for several use a List |
Icons: activity, bell, book, calendar, chart, chat, check, check-circle, clock, cloud, code, database, document, flag, folder, globe, home, image, info, key, lightbulb, lightning, link, lock, mail, phone, pin, play, search, settings, star, tag, target, trend-down, trend-up, user, users, wallet, warning.
| Component | Props |
|---|---|
Metric |
value (bindable: a number), label (optional, above the number), delta (bindable: the change, shown as given with an arrow by its sign — a number, or text with a sign and a unit such as "+4%" or "-2 pts"; format does not apply to it), format (number, compact, percent — 0.31 is 31%), prefix, suffix, note (a few words under the number), tone (colours the number), deltas (bindable: up to three changes in place of delta, each { "value": …, "label": …, "good": … } — see Delta), spark (bindable: the number's recent history as numbers, oldest first, drawn as a small line under it). value may be a short phrase that says the fact whole ("2 missed SLAs", "18% unused"). Inside a Card it draws without its tile, as the card's number |
Delta |
value (bindable: a number, or text with a sign and a unit such as "+4%"), label (what it is against: "vs last month"), good (up default, down). A change on its own. A rise draws green and a fall red; good: "down" turns that round for a number where a fall is the good news (churn, cost). For the change of a headline number use the Metric's own delta |
KeyValue |
items (bindable): [{ "label": …, "value": … }] |
DataTable |
rows (bindable: a list of objects), columns (keys to show, in order; default: the first row's), groupBy (a key: rows sharing its value sit under one heading the reader can close; a grouped table does not page), filterBy (a key: its values become filter chips above the table), cells (how a column draws, by key — see below), search, sort (default on), pageSize (default 25) |
Chart |
kind (bar, line, area, pie), data (bindable: a list of objects), x (label key), y (a numeric key, or a list for several series; pie takes one), stacked, horizontal (bars on their side, for long labels or a ranking; bar only), highlight (the x values to mark: the other bars or slices step back, a line gets a point there), forecastFrom (the x value where the forecast starts: from there bars draw hollow and a line dashed; not pie, not a stacked area). Bar only: normalize (with stacked, every bar drawn to 100% and its series as shares), target (a numeric key drawn as a tick across each bar: a goal or a budget to read the bar against), mark (bar; lollipop, a stem with a dot, for many categories; dumbbell, two y keys joined by a line, for the gap or the change between them). Line only: ranked (each series' rank at every x, 1 at the top, in place of its value: who overtook whom). A line over two rows is a slope chart |
Scatter |
data (bindable: a list of objects), x and y (numeric keys), labelBy (the key naming each point, shown on pointing at it), sizeBy (a numeric key for the point's size), groupBy (a key sorting points into coloured groups; six at most read well). For how one number moves with another, and which points sit apart |
Heatmap |
data (bindable: a list of objects, one per cell), x (the key for the column), y (the key for the row), value (the numeric key), format, prefix, suffix, hideValues (the shading alone, with its range under it). A grid of numbers shaded by size. Columns and rows come in the order the data first names them: sort in the query |
Distribution |
kind (histogram, box), data (bindable: a list of objects, one per measurement), value (the numeric key), bins (histogram: about how many to aim for; the edges are kept to round numbers), groupBy (box: a key giving one box per group), format, prefix, suffix. How a set of numbers is spread: a histogram shows where they pile up, a box the median, the middle half, the range and the values far outside. Pass the raw rows, not counts |
Funnel |
data (bindable: a list of objects, one per stage, in order), label (the key for the stage), value (the numeric key), format, prefix, suffix. What is left at each stage of a process, with each stage's share of the first and of the one before |
Treemap |
data (bindable: a list of objects), label (the key for each part), value (the numeric key, above zero), groupBy (a key gathering parts into coloured groups; six at most read well), format, prefix, suffix. Parts of a whole as rectangles sized by their number, for more parts than a pie can hold |
Flow |
data (bindable: a list of objects, one per link), from and to (the keys for a link's two ends), value (the numeric key, above zero), format, prefix, suffix. How a quantity moves between stages, as bands as wide as what they carry. A name used as a to and later as a from is one node, so links chain into columns; the flow must not return to where it started |
List |
rows (bindable: strings, or { "title": …, "detail": … } for bullets), ordered. Give the rows more and they draw as rows, one line each: icon / avatar / lead in front, value and badge (with badgeTone) at the end, url to make the title a link. Use the same parts on every row |
Progress |
value (bindable: a number), max (default 100), label (with it, the bar shows the label and "value / max"; without it, the bar alone) |
Rating |
value (bindable: a number, filled to the fraction), max (marks, default 5, at most 10), shape (star by default, heart, circle), label (what is rated, before the marks), count (bindable: how many ratings it rests on, after them: 128 or "128 reviews"). Marks in the theme's ink with the number beside them, for a review score, a grade or a level of confidence; a quantity is a Metric |
Spark |
kind (bars, line, dots), values (bindable: numbers), highlight (positions from 0 to mark), tone (the marks' colour), label (what it shows, in words). A small chart with no axes, for the foot of a Card: bars to show which ones stand out, line for a trend, dots for where one value sits among the rest |
Timeline |
items (bindable): [{ "title": …, "date": …, "detail": …, "tone": … }], in the order to show; only title is required |
Spark bars require nonnegative values; use line or dots for signed values.
DataTable cells, one entry per column key:
"cells": {
"Status": { "as": "badge", "tones": { "Won": "success", "Lost": "danger" } },
"Change": { "as": "delta", "suffix": "%" },
"Amount": { "format": "number", "prefix": "€" },
"Proposal": { "toneBy": "proposalTone" },
"Source": { "as": "link", "urlBy": "sourceUrl" },
"Hours": { "noteBy": "hoursNote" }
}as:badgefor a status;deltafor a change (a positive number green with a plus, a negative one red; add"good": "down"where a fall is the good news, such as churn or cost);linkfor a cell that opens the address in the columnurlBynames (http or https only).tonescolours a cell by its exact value.toneBynames another column of the same row that holds the tone (success,warning,danger,accent): use it when the colour depends on the row, not on the text ("€1,842,100" is red because it is worse than today's price). Compute that column where the rows are produced.noteBynames another column of the same row that holds where the cell's value comes from or how it was worked out, in a sentence or two of plain text. The cell gets a dotted underline and the reader opens the note by pointing at it. A row with nothing in that column has no note.format(number,compact,percent),prefix,suffixshape a number. Withoutformata number shows exactly as stored, so a year or an id stays as it is: give every amount column aformat.- A column used only by other columns'
toneBy,urlByornoteByis hidden; a column that references itself stays visible when listed. The first shown column names the row and draws one step heavier: put the name there.
A draft is shown the way its reader will meet it, with a copy button. An email also opens in the reader's mail app and a post on X in X, filled in, for the reader to send. Text is plain, line breaks kept.
| Component | Props |
|---|---|
EmailPreview |
subject, body, from, to, cc |
SocialPost |
platform (linkedin, x), author, text, byline (the line under the author: a headline on LinkedIn, the @handle on X). Near the platform's limit it shows its length against it; a LinkedIn post folds after three lines, as in the feed |
ChatMessage |
author, text, platform (slack, teams: drawn as that app lays a message out; leave it out for any other chat), channel (where it goes: "#sales" in Slack, "Sales > General" in Teams), time (as shown: "10:42"), subject (the headline of a Teams channel post; Slack has none) |
One object each: what was said, what is left to do, which option to pick, who, where to read more, when to meet. They show state; the reader cannot tick, accept or edit them.
| Component | Props |
|---|---|
Quote |
text, source (who or what said it), detail (their role, or the place in the document) |
Checklist |
items (bindable): [{ "text": …, "done": … }]; done is true/false, or 1/0 from a table |
Comparison |
criteria (the row labels, in order), options (2–4): [{ "name": …, "values": { "<criterion>": … }, "recommended": … }]. A value is text, a number, or true/false (drawn as a check or a dash) |
Profile |
name, kind (person default, company), subtitle (role and employer, or industry and place), description, facts: [{ "label": …, "value": … }] |
LinkCard |
url (http or https only), title, description, source (the site's name; default: the address) |
CalendarEvent |
title, start, end (ISO 8601: 2026-11-12 for all day, 2026-11-12T10:00 for a time, in the reader's time zone unless it carries an offset), location, attendees (names), note |
Calendar |
events (bindable: rows, one per event), startBy / endBy / titleBy (the columns to read; default start, end, title; dates as for CalendarEvent), kindBy and kinds (a column that sorts events into kinds, and per kind a tone and an icon), view (month default, week, day: what it opens as), month (2026-11: the month it opens on) or date (2026-11-12: the day a week or day view opens on); default the first event's, week (full default, work for Monday to Friday), weekStart (monday, sunday; default the reader's own). The reader can page and switch between month, week and day. Open as month for a plan over weeks; as week or day when the times matter, where timed events sit on an hour grid (give them an end, or they draw half an hour long) and all-day ones in a band above it. A timed event that runs past midnight into another date sits in that band too, on each day it covers, not on the hour grid. A row with no readable start is left out and counted |
Bind tables and charts to whole rows ({ "$data": "deals" }) and pick columns with the component's own columns / x / y. A binding's own columns / column pick values out of rows ({ "$data": "deals", "column": "company" } gives a List its strings), but that drops the keys, so a table would lose its headers.
A view reads top to bottom as an answer, then its evidence. Build it in this order and stop when the view has said what it needs to:
- What this is: a
PageHeaderwith the subject and one line about it. - The answer: a
Heading(level 3) stating the conclusion as a sentence ("Counter at the 4% cap"), and a mutedTextgiving the reason in a line or two. Skip it for a plain status board. - The numbers that carry it: a
Gridof two to fourMetrics. Give atoneonly to the ones that are good or bad; leave the rest neutral. - The detail: one
Cardper topic, with atitleand a one-linedescription, holding aDataTableor aChart. - How it was counted: a
Disclosurelast.
For a dashboard with supporting facts, wrap steps 2 to 5 in a Split: the main column is a Stack of the answer, the metrics and the detail cards; the rail is a Stack of small Cards. A rail card is one fact in three parts and no more: a Metric with no label whose value says the fact whole, one note sentence, then a Spark or a Progress (without a label) that shows the shape behind it. Three or four rail cards at most.
"split": { "type": "Split", "props": {}, "children": ["main", "rail"] },
"rail": { "type": "Stack", "props": {}, "children": ["uptime"] },
"uptime": { "type": "Card", "props": {}, "children": ["missed", "months"] },
"missed": { "type": "Metric", "props": { "value": "2 missed targets", "note": "March and August, against a 99.95% target." } },
"months": { "type": "Spark", "props": { "kind": "bars", "values": [10, 10, 4, 10, 10, 10, 10, 5, 10, 10, 10, 10], "highlight": [2, 7], "tone": "danger", "label": "Monthly uptime; March and August missed the target" } }Rules that keep it tidy:
- Everything below the metrics sits in a
Cardwith a title. A bareKeyValue,List,ChartorProgresson the page has nothing saying what it is. - One
Cardper topic; never a card in a card. A draft (EmailPreview,SocialPost,ChatMessage), aProfile, aLinkCardand aCalendarEventare already panels: put them straight in aStackor aGrid, not in aCard. - Colour means good or bad, nothing else. One tinted
Card(tone) per view at most, for the thing the reader must act on. - Equal things go in a
Grid(metrics, profiles, link cards); unequal things in aSplit. Don't use aGridto put a table beside a small card. - Leave
gapout. The default is the one space between panels, across and down, in everyStack,GridandSplit; setting it on one of them is what makes a page look uneven. Usesmonly to tie aHeadingto theTextunder it, andlgonly between separate topics on a long page. - Headings: the
PageHeaderis the only large title. Everything else that needs a heading is aCardtitle or a level 3Heading; don't use levels 1 and 2 beside aPageHeader. - Format in the data, not in the reader's head: amounts with
formatand aprefix, dates written out ("3 Dec 2026", not "2026-12-03"). - A status column is a
badgecell and a change column adeltacell; don't write "+12%" or a coloured word into the data. - A
Comparisonwhen the reader is choosing between a few options on the same criteria; aDataTablewhen there are many rows. - A table with a natural category (a status, a team, a phase) reads better with
groupBythan with that category repeated in every row. - Labels are short nouns ("Open deals"), not sentences. No emojis.
Every line of text in a panel is something to read, so each panel gets as few as say it. Count the lines before writing a card: more than a headline, one sentence and one visual means it is two cards or too many words.
- Fold the label into the number. Not a label "Missed SLAs" over a value "2", but one value: "2 missed SLAs". Not "Market comparison" over "+11%", but "11% above market". Keep a separate
labelonly in a row of tiles that compare like with like ("Their proposal", "Counter-offer", "Saving"), where the label is what differs. - A note is one sentence that says why the number matters or where it comes from, not a second headline. If it needs two sentences, cut one.
- Never say a thing twice. A card titled "Terms" doesn't need "A table of terms" under it; a
Progressunder "18% unused" needs no label and no "82 / 100". - State the conclusion, don't name the topic. "Counter at the 4% cap", not "Recommendation". "Three deals have no owner", not "Ownership".
- A
descriptionon aCardonly when the title leaves a real question open (what is being compared, over what period). Otherwise leave it out. - A chart only when the shape matters (a trend, a comparison); otherwise a table. Give it a
Cardtitle that says what it shows.