nextui.dev
Home
Docs
Saved
Pricing
Components37
  • Forms & inputs7
  • Cards13
  • Buttons, badges & avatars8
  • Feedback & display6
  • Effects3
Agents23
  • Chat inputNew
  • Task checklistNew
  • ReasoningNew
  • Tool callNew
  • Model pickerNew
  • Tool approvalNew
  • AttachmentsNew
  • SourcesNew
  • Agent timelineNew
  • Context meterNew
  • Artifact panelNew
  • Message actionsNew
  • Streaming messageNew
  • Sub-agentsNew
  • Conversation shellNew
  • Agent questionNew
  • Voice agentNew
  • Voice orbNew
  • Thinking ring
  • Thinking waveNew
  • Thinking sparkle
  • Thinking bot
  • Prompt deckNew
Blocks20
  • Agent chatNew
  • Pill heroNew
  • Grid hero
  • Moodboard generatorNew
  • Waitlist heroNew
  • Intro bannerNew
  • Creative home heroNew
  • Chat heroNew
  • App shelfNew
  • Usage card
  • Design resultsNew
  • Pricing tiers
  • Dashboard home
  • The shiftNew
  • Launch perksNew
  • Testimonials
  • Quote
  • Team
  • Leads tableNew
  • Sign in
Pages13
  • ASCII workspace$49
  • Research agent$49
  • Support agent$49
  • Coding agent$49
  • CRM overviewNew
  • Marketing dashboardNew
  • Developer portfolio$49
  • Particle landing$49
  • Particle story$49
  • Statement converter$49
  • AI photo studio$49
  • Group card launch$49
  • Month-end storyNew
Themes9
  • Default
  • Ember
  • Ocean
  • Forest
  • Grape
  • Rose
  • Amber
  • Clay
  • Brutal
Upgrade
nextui.dev

nextui components, blocks and themes you install with one command.

Product

  • Components
  • Blocks
  • Themes
  • Pricing

Resources

  • Docs
  • Roadmap
  • GitHub

Legal

  • License
  • Privacy
  • Terms
  • Refunds

nextUI

[ 200 OK ] · nextUI

© 2026 NEXTUI • All rights reserved.

Upgrade
ComponentsAI & agentsAgent question
Copy promptCopy prompt

Customize

What the agent needs to know

One line on why the agent is asking

Allow more than one choice; onAnswer then gets an array

Show a field for an answer that is not in the list

Text of the submit button

Loop a scripted answer while on screen, for demos

JSX · copied with Copy prompt

<AgentQuestion autoPlay />

Agent questionNew

Inline card for when an AI agent stops to ask the user something: the question and why, choices with descriptions (one or several), a field for another answer, number-key shortcuts, then a settled 'You answered' line. Answers a client-side ask tool with the Vercel AI SDK.

Installation

Set your access key from API keys as NEXTUI_TOKEN in .env.local and add the @nextui namespace below to components.json once. Then every item installs by name. Each install counts as a copy on a free account.

$pnpm dlx shadcn@latest add @nextui/agent-question
1{
2 "registries": {
3 "@nextui": {
4 "url": "https://nextui.dev/r/{name}.json",
5 "headers": { "Authorization": "Bearer ${NEXTUI_TOKEN}" }
6 }
7 }
8}

Usage

1"use client";
2
3import { useChat } from "@ai-sdk/react";
4import { AgentQuestion } from "@/components/nextui/agent-question";
5
6// Server: a tool with no execute, e.g.
7// ask_user: tool({ description: "Ask the user when you need a decision",
8// inputSchema: z.object({ question: z.string(), options: z.array(z.string()) }) })
9export function Messages() {
10 const { messages, addToolOutput } = useChat();
11
12 return messages.flatMap((message) =>
13 message.parts.map((part, i) =>
14 part.type === "tool-ask_user" && part.state !== "input-streaming" ? (
15 <AgentQuestion
16 key={i}
17 question={part.input.question}
18 options={part.input.options.map((label) => ({ label }))}
19 answer={part.state === "output-available" ? String(part.output) : null}
20 onAnswer={(answer) => addToolOutput({ tool: "ask_user", toolCallId: part.toolCallId, output: answer })}
21 />
22 ) : null,
23 ),
24 );
25}

API reference

Edit props live in the preview above, or see all 12 props
PropTypeDefaultDescription
questionReactNode–What the agent needs to know
descriptionReactNode–One line on why the agent is asking
options{ label: string; description?: string }[]3 sample segmentsThe choices; 1–9 on the keyboard pick them
multiplebooleanfalseAllow more than one choice; onAnswer then gets an array
allowOtherbooleantrueShow a field for an answer that is not in the list
otherPlaceholderstring"Something else…"Placeholder of that field
submitLabelstring"Answer"Text of the submit button
answerstring | string[] | null–Controlled answer; once set the card shows the settled line
onAnswer(answer: string | string[]) => void–Called with the chosen label(s) or the typed answer
onSkip() => void–Shows a Skip button when set
autoPlaybooleanfalseLoop a scripted answer while on screen, for demos
classNamestring–Extra classes on the wrapper

Related

All components

Chat inputNew

Task checklistNew

Free

ReasoningNew

Sign in to see the code

Preview it freely. A free account copies code and prompts a few times a day.

Sign in