Chat cards
Records list
Three to eight records of one type, each with one line of detail and a value or status. Each row opens the record in your app; a footer link leads to the rest.
When to use it
Section titled “When to use it”Use it when: The answer is a short list of records of one type (open tickets, deals closing soon, recent orders): 3–8 rows, each with a title, one line of detail and a value or status. Rows open the record in your app.
Use something else when: One record (entity card). The user needs to compare several columns or sort (paginated table). The user must pick one to go on (picker).
What the agent receives
Section titled “What the agent receives”| The template calls | The agent gets | When |
|---|---|---|
displayed() | FUNCTION_TOOL_DISPLAYED | As soon as the card shows. The agent goes on. Opening a row is your app’s job. |
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 list loads again in place, for example after Try again or a refresh. While execute runs, the SDK shows its own loader. |
| Empty | execute found no records. The card says so and the agent explains why. |
| Error | execute returned the failure as data, so the agent can explain it. Try again loads the rows 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.
RecordsListData
Section titled “RecordsListData”| Field | Type | Notes |
|---|---|---|
title | string | |
subtitle (optional) | string | |
icon (optional) | IconName | |
records | ListRecord[] | 3–8 rows. More are cut. |
total (optional) | number | How many there are in all. When it’s more than the rows shown, the footer links to the rest. |
noun (optional) | string | What the rows are, plural, for “Show all 12 deals”. Default: “records”. |
allHref (optional) | string | Where “Show all” goes. Without it, the link calls actions.showAll (when given). |
avatarShape (optional) | "square" | "circle" | ”square” (default) for companies and things, “circle” for people. |
footnote (optional) | string | Short note on the left of the footer, e.g. “Sorted by close date”. |
emptyText (optional) | string | Shown instead of rows when records is empty. |
ListRecord
Section titled “ListRecord”| Field | Type | Notes |
|---|---|---|
id | string | Your record’s id: actions.open gets the record back. |
title | string | |
meta (optional) | string | The one line under the title, e.g. “Acme Logistics · closes Nov 28”. |
avatar (optional) | string | Name for the leading avatar’s initials (a person or a company). Default: the title. |
avatarUrl (optional) | string | Logo or photo for the leading avatar. Falls back to initials. |
icon (optional) | IconName | A leading icon instead of an avatar. |
value (optional) | string | number | Trailing value. A number is formatted with format. |
format (optional) | NumberFormat | |
status (optional) | ListStatus | |
href (optional) | string | Opens the record in your app. Without it, the row calls actions.open (when given). |
ListStatus
Section titled “ListStatus”| Field | Type | Notes |
|---|---|---|
label | string | |
tone (optional) | ListTone | neutral (default), info, success, warning, error. |
RecordsListActions
Section titled “RecordsListActions”| Field | Type | Notes |
|---|---|---|
open() (optional) | (record: ListRecord) => void | A row without href was clicked. Open the record in your app. |
showAll() (optional) | () => void | ”Show all” was clicked and there’s no allHref. |
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
- records-list: 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.