Skip to Content
Kokonut UI

AI-06AIUpdated, November 16, 2026

AI Tool Approval

Approve or deny an agent's tool calls. Destructive calls need a press and hold, and decided calls fold into a trace with their output.

Install with
lucide-react, motion

PROSlash Command Menu and more like it are in Kokonut UI Pro

Installation

AI Tool Approval is a free, open-source React component in the Kokonut UI AI collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/ai-tool-approval.tsx, so the code is yours to change.

npx shadcn@latest add @kokonutui/ai-tool-approval

Or add it by hand: install its packages, then copy the source from Copy code above into components/kokonutui/ai-tool-approval.tsx.

npm install lucide-react motion

Usage

import AIToolApproval from "@/components/kokonutui/ai-tool-approval";

export default function Example() {
  return <AIToolApproval />;
}

Props

calls
ToolCall[]

The conversation's tool calls, oldest first. When omitted, a demo run plays with three calls to approve.

onRespond
(id: string, approved: boolean, always: boolean) => void

Called when the user allows or denies a call. always is true when they chose to stop asking for this tool.

className
string

Extra classes for the root element.

ToolCall

idrequired
string
toolrequired
string

The tool's name, such as bash or write_file. Picks the icon.

titlerequired
string

What the agent wants to do, in plain words: "Run a command".

inputrequired
string | Record<string, string | number | boolean>

A command or text shows as code; an object shows as fields.

reason
string

Why the agent wants this, shown under the input.

destructive
boolean

Destructive calls need a press and hold, and are never auto-approved.

staterequired
ToolCallState
output
string[]

Output lines, streamed while running and kept once done.

icon
ReactNode

ToolCallState

The same states the AI SDK gives a tool part, so a part can be passed straight through: approval-requested asks, approval-responded runs, and the output-* states are the result.

type ToolCallState =
  | "approval-requested"
  | "approval-responded"
  | "output-available"
  | "output-denied"
  | "output-error";

Dependencies

NeedsVersionComes from
lucide-react^0.556.0npm, installed by the CLI
motion^12.23.25npm, installed by the CLI
cn from lib/utils.tsshadcn init
React19Your app
Tailwind CSS4Your app

No provider, font or global CSS to set up: the file works as soon as it lands.