Clarifying Question

View registry JSON

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-question
First 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

PropTypeDescription
questionstringRequired. Question displayed to the user.
detailstringOptional. Supporting explanation below the question.
optionsQuestionOption[]Required. Available choices with stable IDs and labels.
multiplebooleanOptional. Allow several answers, confirmed with Continue.
allowOtherbooleanOptional. Offer "Something else" with a field.
otherLabelstringOptional. Label for the custom-answer choice.
answerQuestionAnswer | nullOptional. The answer once given, e.g. the tool's output; shows the folded line.
onAnswer(answer: QuestionAnswer) => voidRequired. Called with the selected or custom answer.
onSkip() => voidOptional. Shows Skip; the agent continues with its own choice.
skippedbooleanOptional. Whether the question has been skipped.
skippedTextstringOptional. Text displayed for a skipped question.
autoFocusbooleanOptional. Move focus into the question when it appears.