Skip to content
Haze UI

AI tool approval

Inline chat tool approval card with standard Allow/Deny controls, session trust toggle, press-and-hold destructive guard and trace fold.

pnpm dlx shadcn@latest add @haze/ai-tool-approval
Open preview in a new tab
Livesmall script

When to use

  • Gating a single agent command inside an active chat turn before execution
  • Adding a press-and-hold safeguard on destructive SQL or shell operations while keeping routine calls quick
  • Folding resolved approvals into a compact expandable output trace

When not to use

  • Reviewing a multi-item backlog of approvals across several background agents; use agent-approvals
  • Confirming a standalone non-chat action outside an assistant conversation; use hold-to-confirm

Installation

Add the Haze registry to components.json once, then install AI tool approval with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/ai-tool-approval
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
idstring"haze-ai-tool-approval"Unique prefix for heading, checkbox and hint IDs.
headingstring"Inline tool approval"Card header title.
standardScenarioApprovalScenariobash test suite commandDefault non-destructive tool call scenario.
destructiveScenarioApprovalScenarioSQL DROP TABLE commandDestructive tool call scenario guarded by press-and-hold.
classstring–Extra classes on the outer section.

Keyboard interactions

Tab
Move across mode buttons, trust checkbox, Deny, Allow or hold confirmation and Reset
SpaceEnter (hold)
Fill and confirm the destructive tool approval button
Escape
Cancel an active keyboard hold before completion

Accessibility

  • The destructive hold button supports pointer press, holding Space or Enter, Escape to cancel, instant completion under reduced motion and an explicit secondary confirm disclosure.
  • Mode switches, approval decisions and resets announce concise updates through a polite role="status" live region.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI block "AI tool approval" with `npx shadcn@latest add @haze/ai-tool-approval`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import AiToolApproval from "@/components/haze/blocks/ai-tool-approval.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/ai-tool-approval.md

  • Customize with real content

    Adapt the Haze ai-tool-approval block for our product. Replace the demo values of these props with our real content: id, heading, standardScenario, destructiveScenario, class. Keep the layout, the heading level rules and these accessibility details: The destructive hold button supports pointer press, holding Space or Enter, Escape to cancel, instant completion under reduced motion and an explicit secondary confirm disclosure. Mode switches, approval decisions and resets announce concise updates through a polite role="status" live region. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using ai-tool-approval, check it fits: use it when gating a single agent command inside an active chat turn before execution; adding a press-and-hold safeguard on destructive sql or shell operations while keeping routine calls quick; folding resolved approvals into a compact expandable output trace. Avoid it when reviewing a multi-item backlog of approvals across several background agents; use agent-approvals; confirming a standalone non-chat action outside an assistant conversation; use hold-to-confirm. Alternatives: @haze/agent-approvals, @haze/hold-to-confirm, @haze/ai-tool-calls.

Dependencies

  • npm: @lucide/astro
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog