uimaxxer

Approval

An agent asks before it acts, and the hold fills the command itself: ink runs through it letter by letter while you hold, so you read what you approve as you approve it. Let go and it drains back.

npx shadcn@latest add @uimaxxer/approval
Pro
PasskeysFix the duplicate Stripe charge

Migration 0042 stopped halfway. Get staging back to a clean schema.

Captain

Run pnpm db:reset on staging?

Migration 0042 stopped halfway. Atlas wants a clean schema before it retries.

Drops and reseeds 31 tables on staging-eu. The last backup is from 06:40 today.

pnpm db:reset --env staging --seed fixtures/billing

Run pnpm lint --fix in billing-service?

Formats the 14 files in #482 before review.

pnpm lint --fix --filter billing-service

Usage

import { Approval } from "@/components/ui/approval"

<Approval
  dangerous
  title={<>Run <code>pnpm db:reset</code> on staging?</>}
  effect="Drops and reseeds 31 tables on staging-eu."
  command="pnpm db:reset --env staging"
  onDecision={({ approved, scope }) => agent.reply(approved, scope)}
/>

Props

PropTypeDefaultWhat it does
titleReactNodeThe question. Inline <code> is set as code.
commandstringThe exact command. The hold inks it letter by letter; a tapped approval inks it in one quick sweep.
reasonReactNodeWhy the agent wants it.
effectReactNodeWhat it will do. Set in the danger colour when dangerous.
dangerousbooleanApprove becomes a hold, and always-allow is not offered.
alwaysLabelReactNodeOffers a once / always choice, e.g. Always for pnpm lint.
holdDurationnumber1400Hold length in ms for dangerous actions.
onDecision({ approved, scope }) => voidCalled once. The card then collapses to one line.
autoFocusbooleantrueFocus on mount so Enter and Esc work at once.
resolvedLabel(decision) => ReactNodeText for the collapsed line.

Keyboard

Enter
Approve
Esc
Deny
Space or Enter (hold)
Approve a dangerous action
← →
Once or always

Accessibility

  • A labelled group: the question is the label, reason and effect are the description.
  • Dangerous requests focus the hold button, so a held Enter or Space inks the command and approves, and a tap cannot.
  • The command keeps its plain text as its accessible name; the per-letter ink is hidden from assistive tech.
  • The scope is a radiogroup with arrow keys. The outcome is announced as status.