BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/trovecn/approval-request

Approval Request

trovecn/approval-request
FreeComponent

A stable, explicit pause for a human decision inside an agent run — never a spinner standing in for consent.

Install it

npx shadcn@latest add https://trovecn.dev/r/approval-request.json

Source

src/components/trovecn/ai-workbench/approval-request.tsxtrovecn.dev/r/approval-request.json · first 6 KB
1"use client";
2
3import { useEffect, useId, useState, type ReactNode } from "react";
4import { CheckIcon, ChevronDownIcon, Loader2Icon, RotateCcwIcon, XIcon } from "lucide-react";
5import { AnimatePresence, motion, useReducedMotion } from "motion/react";
6
7import { Button } from "@/components/ui/button";
8import { spring } from "@/lib/springs";
9import { cn } from "@/lib/utils";
10
11export type ApprovalRequestStatus = "pending" | "approved" | "denied" | "expired" | "cancelled";
12
13export interface ApprovalRequestDetail {
14 summary: ReactNode;
15 /** Compact key:value parameters, rendered in mono — counts, paths, filters. */
16 items?: readonly ReactNode[];
17 /** Full-sentence content (a message draft, a diff) rendered as body copy instead of mono. */
18 preview?: ReactNode;
19}
20
21export interface ApprovalRequestProps {
22 id: string;
23 /** The action being approved, stated as what will happen — not a question. */
24 title: ReactNode;
25 /** One-line requester context: which agent or tool call, and where in the run. */
26 context?: ReactNode;
27 detail?: ApprovalRequestDetail;
28 /** Freeform label for whichever category applies ("Irreversible," "Customer-facing," …). No fixed vocabulary — the caller writes it. */
29 flag?: ReactNode;
30 /** Binary, not a severity scale: trove/cn has one semantic warning colour. */
31 flagTone?: "default" | "critical";
32 /** Caller-owned source of truth. This component renders it; it never sets it itself. */
33 status: ApprovalRequestStatus;
34 /** Renders a static deadline label. Not a timer — the caller still drives the transition to "expired". */
35 expiresAt?: Date;
36 decidedBy?: ReactNode;
37 decidedAt?: ReactNode;
38 /** A rejected promise renders the anchored inline error state with Retry — never a toast. */
39 onApprove?: () => void | Promise<void>;
40 onDeny?: () => void | Promise<void>;
41 /**
42 * "card" (default) is the standalone, persistent-in-stream surface this
43 * component is built for. "embedded" strips its own card chrome for the
44 * one sanctioned nesting case — ToolRun handing its body off to this
45 * component for the needs-approval status — so the pause reads as one
46 * card, not two stacked shadows.
47 */
48 variant?: "card" | "embedded";
49 className?: string;
50}
51
52type DecisionAction = "approve" | "deny";
53type Phase = "pending" | "submitting" | "error" | "resolved";
54
55const RESOLVED_COPY: Record<
56 Exclude<ApprovalRequestStatus, "pending">,
57// … truncated

What it pulls in

npm packages

  • lucide-react
  • motion

Other registry items

  • utils
  • button
  • springs

Files it writes

  • src/components/trovecn/ai-workbench/approval-request.tsx

Facts

Registry
trovecn
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-14
Last confirmed
today

Go to the source

trovecn.dev PPRAMANIK62/trovecn on GitHub Raw registry item This item as JSON

More from trovecn

All 26 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordiontrovecnComponentsFree3 deps
Agent Activityagent-activitytrovecnComponentsFree2 deps
ButtonbuttontrovecnComponentsFree2 deps
CheckboxcheckboxtrovecnComponentsFree2 deps
Checkbox Groupcheckbox-grouptrovecnComponentsFree2 deps
ComboboxcomboboxtrovecnComponentsFree3 deps
Comparison Slidercomparison-slidertrovecnComponentsFree1 dep
Context Menucontext-menutrovecnComponentsFree3 deps

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex