nextui.dev
Home
Docs
Saved
Pricing
Components37
  • Forms & inputs7
  • Cards13
  • Buttons, badges & avatars8
  • Feedback & display6
  • Effects3
Agents17
  • Chat inputNew
  • Task checklistNew
  • ReasoningNew
  • Tool callNew
  • Tool approvalNew
  • SourcesNew
  • Agent timelineNew
  • Artifact panelNew
  • Streaming messageNew
  • Conversation shellNew
  • 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
Pages10
  • ASCII workspace$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 & agentsTool approval
Copy promptCopy prompt

Customize

The question, in plain words

One line on what happens if the user approves

Tool name shown as a chip

Controlled status; leave unset to let the buttons drive it

Text of the approve button

Text of the deny button

Loop a scripted approval while on screen, for demos

JSX · copied with Copy prompt

<ToolApproval autoPlay />

Tool approvalNew

Inline card that asks the user before an AI agent runs a tool with side effects: the question, the tool name, its arguments as rows, and Approve / Deny buttons that settle into an approved or denied line.

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/tool-approval
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 { ToolApproval } from "@/components/nextui/tool-approval";
5
6// AI SDK 6: give the tool needsApproval: true on the server, then answer the request here.
7export function Messages() {
8 const { messages, addToolApprovalResponse } = useChat();
9
10 return messages.flatMap((message) =>
11 message.parts.map((part, i) =>
12 part.type === "tool-send_email" && part.state === "approval-requested" ? (
13 <ToolApproval
14 key={i}
15 title="Send this email?"
16 toolName="send_email"
17 details={{ To: part.input.to, Subject: part.input.subject }}
18 onApprove={() => addToolApprovalResponse({ id: part.approval.id, approved: true })}
19 onDeny={() => addToolApprovalResponse({ id: part.approval.id, approved: false })}
20 />
21 ) : null,
22 ),
23 );
24}

API reference

Edit props live in the preview above, or see all 11 props
PropTypeDefaultDescription
titleReactNode"Send this email to 3 people?"The question, in plain words
descriptionReactNode–One line on what happens if the user approves
toolNamestring"send_email"Tool name shown as a chip
detailsRecord<string, ReactNode>–Arguments the agent wants to use, shown as label and value rows
status"pending" | "approved" | "denied"–Controlled status; leave unset to let the buttons drive it
onApprove() => void–Called when the user approves
onDeny() => void–Called when the user denies
approveLabelstring"Approve"Text of the approve button
denyLabelstring"Deny"Text of the deny button
autoPlaybooleanfalseLoop a scripted approval while on screen, for demos
classNamestring–Extra classes on the wrapper

Related

All components

Chat inputNew

Task checklistNew

ReasoningNew

Sign in to see the code

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

Sign in