terminal-kit/components/question-prompt.tsx
$
cat components/question-prompt.tsx
# question-prompt
Multiple-choice Q&A for ambiguous tasks. QuestionPrompt collects the answer and can show the selected option inline.
when to use — Call from ask_user or render when the agent needs a multiple-choice answer. Pass selectedId to show the chosen option.
──
examples
Basic choices
Keyboard-navigable options with a built-in custom answer row.
[1/1] ↑/↓ navigate · Enter: select · last option: type custom
Which design direction should we use?
3
Answered
After selection, QuestionPrompt marks the chosen option.
──
component api
QuestionPrompt
PropTypeDefaultDescription
question *stringQuestion text shown above options.
options *QuestionOption[]Choices to render. Shape: { id: string; label: string; description?: string }.
selectedIdstringWhen set, the prompt hides after the user selects an option.
initialActiveIndexnumber0Highlight this option on mount (0-based).
indexnumber1Current question index for multi-step flows (1-based).
totalnumber1Total questions in a multi-step flow.
customOptionLabelstring"Something else…"Label for the built-in custom answer row.
customOptionPlaceholderstring"Type your answer"Placeholder for the custom answer field.
onSelect(id: string, customValue?: string) => voidCalled when the user selects an option or submits a custom answer.
classNamestringAdditional CSS classes.
──
install
npx shadcn@latest add "https://www.terminal-kit.com/r/question-prompt.json"