Skip to content
Talk to an engineer

Chat cards

Chart

One chart in a chat card: a trend with its previous period dashed behind it, bars grouped or stacked, or a donut breakdown. A headline carries the latest number and its change; hover or tap reads any point.

KindRead-onlyAgent waitsNoTypesLine, bar (grouped or stacked), donutMobileSame card, taller plot, 44px legend keys

Use it when: The answer is a shape, not one number: a trend over time (line), amounts per period or channel (bars, grouped or stacked), or how a whole splits up (donut). One to three series, plus a previous period to compare against.

Use something else when: A few headline numbers without their history (KPI tiles). Exact values to look up or sort (table). More than three series, or a full report with findings (report canvas).

The template callsThe agent getsWhen
displayed()FUNCTION_TOOL_DISPLAYEDAs soon as the chart shows. The agent goes on; it already has every number from execute.

Besides its data, the template draws these as itself, with mountState(). Pick one on the preview with State.

StateWhen it shows
LoadingWhile the card loads again in place, for example after Try again. While execute runs, the SDK shows its own loader.
Emptyexecute found no data for the period. The card says so and the agent explains why.
Errorexecute returned the failure as data, so the agent can explain it. Try again loads in place.
mountState({ root, head, title: "…", state: { kind: "error", text: "…", retry } });

The hosted action and the in-page handler below show each case. The state types are LoadingState, EmptyState and ErrorState in fs-kit.

FieldTypeNotes
type"line" | "bar" | "donut"line: a trend over time. bar: amounts per period or category. donut: parts of one whole.
titlestring
subtitle (optional)string
icon (optional)IconNameDefault: chart, bars or pie, by type.
labelsstring[]The x-axis labels, oldest first. On a donut, the slice names.
seriesChartSeries[]1 to 3 series plus one compare series; more are cut. A donut draws its first series, up to 5 slices (the rest become Other).
stacked (optional)booleanBars only: stack the series instead of grouping them. Values should be 0 or more.
format (optional)NumberFormatHow the axis, the tooltip and the headline format values.
headline (optional)ChartHeadlineThe number above the chart, with its change.
footnote (optional)stringShort note on the left of the footer, e.g. “Excludes refunds”.
link (optional){ label: string; href: string }A footer link to the full report in your app.
FieldTypeNotes
namestringThe legend and tooltip name, e.g. “2026” or “Organic”.
valuesnumber[]One value per label, in the same order.
compare (optional)booleanA comparison series (last year, last period, a target): muted and dashed, never stacked. At most one.
FieldTypeNotes
value (optional)number | stringThe big number. Default: the last period’s value (summed when stacked), or a donut’s total.
label (optional)stringWhat the number is, e.g. “Revenue in November”. Default: the last label, or “Total” on a donut.
delta (optional)numberChange in percent. Default: the last period against the compare series, or the period before.
good (optional)booleanfalse when up is bad (costs, churn). Default: up is good.
vs (optional)stringWhat the change is against, e.g. “vs Nov 2025”.

Copy the template and the shared kit into your code: agent/ui/ in an agent repo, or anywhere in your app. The template imports only ./fs-kit.js. Then wire it up from the hosted action or the in-page handler.

The hosted action needs an agent repo with one folder per action (agent/actions/<action_key>/index.ts). If your repo keeps its actions in agent/actions/index.ts, use the in-page handler: it runs the same template in your app.

All templates in machine-readable form: /ui-catalog/catalog.json.