Utility
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
| Prop | Type | Default |
|---|---|---|
name | string | required |
description | string | - |
args | Record<string, unknown> | - |
risk | "low" | "medium" | "high" | "low" |
onApprove | () => void | required |
onDeny | () => void | required |
onAlwaysAllow | () => void | - |
timeout | number | - |
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/Endselect the first or last enabled item;Enter/Spaceactivate, select, or toggle;Escapecancels or closes an owned surface;Tab/Shift+Tabmove 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.