/
1.1k
Sponsor

Tool Approval

Interactive approval prompt for AI tool calls with risk-level badge, args display, and auto-deny timeout

Terminal

Installation

$ pnpm dlx shadcn@latest add @termcn/ink/tool-approval

Usage

import { ToolApproval } from "@/components/ui/tool-approval";
<ToolApproval
  name="execute_shell"
  description="Run a shell command on the host machine"
  args={{ command: "rm -rf ./dist" }}
  risk="high"
  onApprove={() => console.log("approved")}
  onDeny={() => console.log("denied")}
  timeout={30}
/>

API Reference

ToolApproval

PropTypeDefault
namestringrequired
descriptionstring-
argsRecord<string, unknown>-
risk"low" | "medium" | "high""low"
onApprove() => voidrequired
onDeny() => voidrequired
onAlwaysAllow() => void-
timeoutnumber-

Notes

Accessibility

termcn exposes the following behavior through Ink's terminal accessibility APIs. This is not a browser ARIA or general WCAG-conformance claim.

  • Keyboard: Arrow keys move inside the composite; Home / End select the first or last enabled item; Enter / Space activate, select, or toggle; Escape cancels or closes an owned surface; Tab / Shift+Tab move between termcn/Ink focus targets.
  • Focus and composition: Input is active only while the component's focus target is focused, enabled, active, and inside the topmost focus scope.
  • Screen reader: Screen-reader mode removes decorative output while preserving meaningful labels and state.