Skip to content

QuestionAnswer

QuestionAnswer(__namedParameters): Element

Defined in: react/components/controls/question-answer.tsx:76

A “ask the user a question” composite: a prompt, radio/checkbox answers, an optional free-text “Other” input, and a submit button — assembled from the library’s own Form, RadioGroup, Checkbox, Input and Button widgets.

Building it from existing widgets (rather than a bespoke renderer) means it inherits their behaviour for free: real text entry and horizontal scrolling in the Other field, Tab/Shift-Tab focus traversal across the answers and the button, button activation on Enter/Space, and consistent theming.

Aimed at LLM-as-tool flows that present options and await a choice; the answer arrives via onSubmit:

<QuestionAnswer
question="Which database for the cache?"
options={[{ label: "Redis" }, { label: "Postgres", value: "pg" }]}
allowOther
onSubmit={({ selected, other }) => ...}
/>

QuestionAnswerProps

Element