Loading AgentsKit ecosystem navigation…
AgentsKit Chat
Components

Form

Schema-backed fields with a single submit event. Component key `form`.

View canonical Markdown

Form

form collects structured input in one submit. Field types are closed: text, email, number, checkbox, select.

Live preview

Form
Schema-backed fields with a single submit event.
form

Contact

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

When to use

  • Contact, signup, or settings-style capture inside the transcript
  • When the host needs a validated record, not free-text chat
  • Select fields with a bounded option list

Prefer something else when

  • Single pick among options → choice-list or button-group
  • File uploads → file-attachment is display/download only

Props (schema)

FieldTypeNotes
titlestring?Optional form heading
fields1–30 itemsEach has id, label, type, optional required, placeholder, options
fields[].typetext | email | number | checkbox | selectClosed set
fields[].optionsarrayRequired when type is select; forbidden otherwise
submitLabelstringSubmit control label

Frame example

code
{
  "protocol": "agentskit.chat.component",
  "version": 1,
  "type": "render",
  "componentKey": "form",
  "instanceId": "form-fixture",
  "props": {
    "title": "Contact",
    "fields": [
      { "id": "email", "label": "Email", "type": "email", "required": true },
      { "id": "role", "label": "Role", "type": "select", "options": [
        { "id": "eng", "label": "Engineering" },
        { "id": "pm", "label": "Product" }
      ]}
    ],
    "submitLabel": "Send"
  },
  "fallback": {
    "kind": "form",
    "summary": "Contact form."
  }
}

Events

EventValueMeaning
submitformRecord of field id → value (no unknown keys)

Value rules: text/email → string; checkbox → boolean; number → finite number or numeric string; select → option id string. Required fields must be present and non-empty.

Host wiring

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

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

export function App() {
  return (
    <AgentChat
      definition={definition}
      onComponentInteract={(event) => {
        // Always type: 'interact' — never type: 'submit'
        if (event.componentKey !== 'form' || event.event !== 'submit') return
        const values = event.value as Record<string, unknown>
        // e.g. values.email, values.role (select option id)
      }}
    />
  )
}

For agents

FieldValue
componentKeyform
ExportFormComponent
Protocolagentskit.chat.component v1
Envelopetype: "render" + instanceId + props + fallback
Eventssubmit (form)
Host callbackonComponentInteract
Event shapetype always interact; event is submit; value is field-id record
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