Loading AgentsKit ecosystem navigation…
AgentsKit Chat
Components

Choice list

Prompt plus choices with optional descriptions and typed actions — the primary interactive component.

View canonical Markdown

Choice list

choice-list is the primary interactive component: one prompt, 1–20 choices, one selection event on every shell.

Live preview

Choice list
Prompt + 1–20 choices with optional descriptions and typed actions.
choice-list
Where should we go?

Demos use docs host CSS. Package primitives are intentionally unstyled so your product theme owns the look.

When to use

  • Branching product UX (onboarding, triage, “what next?”)
  • Offering options that may trigger a typed action (tool) under policy
  • Anything that must work in React and Ink without a custom DOM tree

Prefer something else when

  • Compact action toolbar without a prompt → button-group
  • Multi-field structured input → form
  • Binary confirm for a side effect under tool policy → approval-request

Props (schema)

FieldTypeNotes
promptstring (1–4096)Shown as the fieldset legend
choices1–20 itemsEach has id, label, optional description, optional action
choices[].idid stringUnique within the list
choices[].descriptionstring?Secondary line under the label
choices[].action{ name, input }Optional; resolves through ChatConfig.tools only

Frame example

code
{
  "protocol": "agentskit.chat.component",
  "version": 1,
  "type": "render",
  "componentKey": "choice-list",
  "instanceId": "destination-choice",
  "props": {
    "prompt": "Where should we go?",
    "choices": [
      {
        "id": "docs",
        "label": "Documentation",
        "description": "Read the component guide."
      },
      { "id": "demo", "label": "Demo" }
    ]
  },
  "fallback": {
    "kind": "choice-list",
    "summary": "Choose Documentation or Demo."
  }
}

Events

EventValueMeaning
selectidSelected choice id

Typed actions

A choice may declare:

code
{ action: { name: 'email.send', input: { to: 'ada@example.com' } } }
  • Name must exist on ChatConfig.tools (AgentsKit tools)
  • Tool must opt into confirmation and pass argument validation
  • Selection proposes a tool call — it never executes

See Action policy and Confirmation.

Host wiring

code
import { ChoiceListComponent, defineComponentManifest, defineChat } from '@agentskit/chat'
import { AgentChat } from '@agentskit/chat/react'

const definition = defineChat({
  id: 'app',
  components: defineComponentManifest([ChoiceListComponent]),
  chat: { adapter },
})

export function App() {
  return (
    <AgentChat
      definition={definition}
      onComponentSelect={(event) => {
        // { type: 'select', componentKey: 'choice-list', instanceId, choiceId }
      }}
    />
  )
}

For agents

FieldValue
componentKeychoice-list
ExportChoiceListComponent
Protocolagentskit.chat.component v1
Envelopetype: "render" + instanceId + props + fallback
Eventsselect (value = choice id)
Host callbackonComponentSelect only (not onComponentInteract)
Optionalchoices[].action → proposed tool via ChatConfig.tools (never auto-executes)
FallbackAlways include fallback.kind + fallback.summary

Do not invent keys or props outside the schema. Unknown keys and invalid props stay inert.

Shells

ShellNotes
React / Vue / Svelte / Solid / AngularFieldset + buttons; replaceable slots
React NativeChoiceListNative accessibility roles
InkArrows / number + Enter