Skip to content
RunsApproval modeMenu

Approval mode

Manual, Auto or Skip, each with one sentence that says what the agent will do without you, a list of saved grants per site and per tool, and calm notices for actions that stay blocked in every mode.

Manual, Auto or Skip, saved grants per site and tool, and the actions that stay blocked in every mode.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/approval-mode.json

Usage

tsx
import {
  ApprovalGrants,
  ApprovalHardBlocks,
  ApprovalMode,
} from "@/components/ui/chatcn/approval-mode"

<ApprovalMode value={mode} onValueChange={setMode} />
<ApprovalGrants grants={grants} onRevoke={(grant) => revoke(grant.id)} />
<ApprovalHardBlocks />

Skip is marked risky: it carries a No approvals tag, inverts when on, and asks once, inline, before it turns on. Pass modes to change the copy or add your own.

Examples

Hard block in a run

HardBlockNotice is the moment the agent reaches a purchase or a permanent delete. It reads as a handoff, not an error: a lock, one line, and Take over.

The calm inline notice when the agent reaches a blocked action, and the empty grants list.

Props

ApprovalMode

PropTypeNotes
modesApprovalModeOption[]{ id, label, description, icon?, risky?, disabled? }
value, defaultValue, onValueChangestringControlled or uncontrolled
skipConfirmbooleanTurn off the inline confirmation for risky modes
labelstringGroup name. Default Approval mode
disabledboolean

ApprovalGrants

PropTypeNotes
grantsApprovalGrant[]{ id, kind: site | tool, name, label?, scope, detail?, icon? }
scopeonce | session | alwaysAllowed once, This session, Always allowed
onRevoke(grant) => voidCalled after the row folds away
onRevokeAll() => voidShows Revoke all

ApprovalHardBlocks and HardBlockNotice

PropTypeNotes
itemsReactNode[]Defaults to purchases, accounts, permanent deletes and security settings
action, targetReactNodeWhat the agent was about to do, and where
onTakeOver() => voidShows Take over on the notice

Keyboard

KeyAction
ArrowUp, ArrowDownMove between modes (native radio group)
Esc in the confirmationCancel and return to the current mode
TabReach each Revoke button. Focus moves to the next one after a revoke

Accessibility

  • Modes are real radio inputs inside labels, so the group, the checked state and arrow keys come from the platform.
  • Revoke buttons are named after what they revoke: Revoke github.com.
  • Hard blocks use plain words and a lock, never red, because nothing is wrong.

Motion

  • The radio fills with a 150 ms inset shadow. Rows change background over 150 ms.
  • The risky confirmation drops in 4 px with a 200 ms fade. Revoked rows fold away over 160 ms.
  • Under reduced motion rows fade without folding.