Chat cards
Picker
The user chooses one, or several, of up to 12 options, each with an icon or avatar, a description and a price or badge. Continue unlocks once something is chosen, and the card collapses to one line after.
When to use it
Section titled “When to use it”Use it when: The next step depends on a choice between 2–12 concrete options the agent already has: a plan, a time slot, an owner, the channels to notify. Each option needs more than a word to choose well: a description, a price, a badge.
Use something else when: Two or three one-word answers (quick replies or ask_user_question). A yes or no before a change (confirm card). Values the user types in (form with approval). Hundreds of options (ask what they’re looking for, then search).
What the agent receives
Section titled “What the agent receives”| The template calls | The agent gets | When |
|---|---|---|
submit({ selected, labels, result }) | FUNCTION_TOOL_SUBMITTED_BY_USER | The user pressed Continue. selected is always an array of option ids, one item unless multiple is on. |
cancel() | FUNCTION_TOOL_CANCELLED_BY_USER | The user pressed Cancel. Nothing was chosen. |
States
Section titled “States”Besides its data, the template draws these as itself, with mountState(). Pick one on the preview with State.
| State | When it shows |
|---|---|
| Loading | While the options load in place: after Try again, or when they load after the card opens (free time slots, say). While execute runs, the SDK shows its own loader. |
| Empty | execute found nothing to choose from: the plan is set by a contract. Cancel reports cancel(), so the agent stops waiting. |
| Error | execute couldn’t read the plans and returned the failure as data. Try again loads them in place. Cancel reports cancel(), so the agent stops waiting. |
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.
PickerData
Section titled “PickerData”| Field | Type | Notes |
|---|---|---|
title | string | |
subtitle (optional) | string | |
icon (optional) | IconName | |
note (optional) | string | The agent’s one line above the options, e.g. why it recommends one. |
options | PickerOption[] | 2–12 options. A search box shows above more than 6. |
multiple (optional) | boolean | Choose several (checkbox cards). Default: one (radio cards). |
max (optional) | number | With multiple: the most the user can choose. |
selected (optional) | string[] | Option ids chosen when the card opens (the agent’s suggestion). |
layout (optional) | "list" | "grid" | ”grid”: two columns of compact tiles, for short options like time slots. |
submitLabel (optional) | string | |
busyLabel (optional) | string | |
cancelLabel (optional) | string | |
searchPlaceholder (optional) | string | |
receiptLabel (optional) | string | Receipt lead-in before the chosen labels. Default “You chose”. |
cancelledText (optional) | string |
PickerOption
Section titled “PickerOption”| Field | Type | Notes |
|---|---|---|
id | string | |
label | string | |
description (optional) | string | |
icon (optional) | IconName | Icon in the option’s leading tile. Ignored when avatar is set. |
avatar (optional) | string | An image URL, or 1–2 initials, for people, accounts and workspaces. |
meta (optional) | string | Right-hand detail: a price, a time, a count. |
metaSub (optional) | string | Small line under meta, e.g. “per month”. |
badge (optional) | string | Short badge after the label, e.g. “Recommended”. |
disabled (optional) | boolean | Shown but can’t be chosen. |
disabledReason (optional) | string | Why it can’t be chosen. Replaces the description. |
PickerActions
Section titled “PickerActions”| Field | Type | Notes |
|---|---|---|
choose() (optional) | (ids: string[]) => Promise<unknown> | Acts on the choice (reserve the slot, switch the plan). Throw to show the error and keep the picker open. |
Install
Section titled “Install”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.
- Hosted action: TypeScript, JavaScript
- In-page handler: TypeScript, JavaScript
- picker: TypeScript, JavaScript
- fs-kit: TypeScript, JavaScript
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.