Clarifying Question
The agent pauses to ask. Pick with a click or a number key, or type your own; it folds into a one-line receipt.
Install with the shadcn CLI
npx shadcn@4.21.5 add @cavemio/clarifying-questionFirst install? Configure @cavemio once
Run npx shadcn@4.21.5 init if shadcn is not set up, then merge this entry into the registries field in your existing components.json. Keep your other settings and registries.
components.json
{
"registries": {
"@cavemio": "https://registry.cavemio.dev/r/cavemio-{name}.json"
}
}Overview
The agent pauses to ask. Pick with a click or a number key, or type your own; it folds into a one-line receipt.
Reuses Number Roll and Text Morph. Demo answers stay local; connect onAnswer and onSkip to your application or AI tool output.
import { ClarifyingQuestion } from "@/components/clarifying-question";
<ClarifyingQuestion question="Which shop is this plan for?" options={[{ id: "main", label: "Main Street" }, { id: "harbour", label: "Harbour Road" }]} onAnswer={handleAnswer} />Props
| Prop | Type | Description |
|---|---|---|
question | string | Required. Question displayed to the user. |
detail | string | Optional. Supporting explanation below the question. |
options | QuestionOption[] | Required. Available choices with stable IDs and labels. |
multiple | boolean | Optional. Allow several answers, confirmed with Continue. |
allowOther | boolean | Optional. Offer "Something else" with a field. |
otherLabel | string | Optional. Label for the custom-answer choice. |
answer | QuestionAnswer | null | Optional. The answer once given, e.g. the tool's output; shows the folded line. |
onAnswer | (answer: QuestionAnswer) => void | Required. Called with the selected or custom answer. |
onSkip | () => void | Optional. Shows Skip; the agent continues with its own choice. |
skipped | boolean | Optional. Whether the question has been skipped. |
skippedText | string | Optional. Text displayed for a skipped question. |
autoFocus | boolean | Optional. Move focus into the question when it appears. |