Loading AgentsKit ecosystem navigation…
AgentsKit Chat
Components

Button group

A labelled set of action buttons with one select event. Component key `button-group`.

View canonical Markdown

Button group

button-group is a compact action row: a group label plus 1–12 buttons. Use it when the model should offer quick actions without a long prompt (unlike choice-list).

Live preview

Button group
A labelled set of action buttons the model may offer.
button-group
Actions

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

When to use

  • Save / discard / open style toolbars in chat
  • Primary + secondary + danger variants on the same row
  • When you need select by button id without free-form input

Prefer something else when

  • Long option lists with descriptions → use choice-list
  • Binary delete gates → prefer confirmation

Props (schema)

FieldTypeNotes
labelstring (1–256)Group label (fieldset legend)
buttons1–12 itemsEach has id, label, optional disabled, optional variant
buttons[].variantprimary | secondary | dangerOptional schema hint — stock shells do not style by variant; map it in your theme/slots
buttons[].disabledbooleanIf true, select is rejected by validation

Frame example

code
{
  "protocol": "agentskit.chat.component",
  "version": 1,
  "type": "render",
  "componentKey": "button-group",
  "instanceId": "button-group-fixture",
  "props": {
    "label": "Actions",
    "buttons": [
      { "id": "save", "label": "Save", "variant": "primary" },
      { "id": "discard", "label": "Discard", "variant": "danger" }
    ]
  },
  "fallback": {
    "kind": "button-group",
    "summary": "Choose Save or Discard."
  }
}

Events

EventValueMeaning
selectidSelected button id

Host wiring

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

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

export function App() {
  return (
    <AgentChat
      definition={definition}
      onComponentInteract={(event) => {
        // type is always 'interact'; branch on event + value
        // { protocol, version: 1, type: 'interact', componentKey: 'button-group', instanceId, event: 'select', value: buttonId }
      }}
    />
  )
}

For agents

FieldValue
componentKeybutton-group
ExportButtonGroupComponent
Protocolagentskit.chat.component v1
Envelopetype: "render" + instanceId + props + fallback
Eventsselect (id)
Host callbackonComponentInteract
Event shapetype always interact; event is select; value is button id
FallbackAlways include fallback.kind + fallback.summary

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

Shells

ShellNotes
React / Vue / Svelte / Solid / AngularSame frame; replaceable slots
React NativeAccessibility roles from the catalog definition
InkTerminal-safe fallback when interactive chrome is limited