npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-approval-request.json --yesApproval request
ProAn AI agent's request for a person's yes before it acts, with Approve and Deny, showing the decision once made, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
import { ApprovalRequest } from '@/components/ui/goop/approval-request';
import { useState } from 'react';
import { CodeBlock } from '@/components/ui/goop/code-block';
import { ToolCall } from '@/components/ui/goop/tool-call';
function InviteApproval() {
const call = { study: 'Diallo Dental', participants: 8, template: 'first-session' };
const [approved, setApproved] = useState(false);
return (
<div className="flex w-96 flex-col gap-2">
<ApprovalRequest
title="Send the invite email to 8 participants"
description="The agent wants to run send_invites."
askReason
onApprove={() => setApproved(true)}
>
<CodeBlock code={JSON.stringify(call, null, 2)} language="json" wrap />
</ApprovalRequest>
{approved ? <ToolCall name="send_invites" state="running" summary="Sending 8 emails" input={call} /> : null}
</div>
);
}When to use
- An AI agent's request for a person's yes before it acts, with Approve and Deny, showing the decision once made.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Approval request on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-approval-request.json --yesAdd the Goop Approval request to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { ApprovalRequest } from '@/components/ui/goop/approval-request';
import { useState } from 'react';
import { CodeBlock } from '@/components/ui/goop/code-block';
import { ToolCall } from '@/components/ui/goop/tool-call';
function InviteApproval() {
const call = { study: 'Diallo Dental', participants: 8, template: 'first-session' };
const [approved, setApproved] = useState(false);
return (
<div className="flex w-96 flex-col gap-2">
<ApprovalRequest
title="Send the invite email to 8 participants"
description="The agent wants to run send_invites."
askReason
onApprove={() => setApproved(true)}
>
<CodeBlock code={JSON.stringify(call, null, 2)} language="json" wrap />
</ApprovalRequest>
{approved ? <ToolCall name="send_invites" state="running" summary="Sending 8 emails" input={call} /> : null}
</div>
);
}- Fits: chat (its recipe).
- In an agent's thread it stands where the run waits, under the message that led to it; its details are the call the agent would make:
<CodeBlock code={json} language="json" />, the same input a ToolCall shows once it ran. - width, padding, gap, corner, text: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| title | string | What the agent wants to do, as a sentence ("Send the invite email to 12 participants"); it names the request. |
| description? | string | A line under it: which tool, or why the agent asks. |
| children? | ReactNode | The details of what it would do, in the card's body: a CodeBlock of the call, Properties, a list. |
| decision? | 'pending' | 'approved' | 'denied' | The decision (controlled): pending asks, approved or denied shows the answer. |
| defaultDecision? | 'pending' | 'approved' | 'denied' = 'pending' | The decision it starts with (uncontrolled). |
| reason? | string | A denial's reason shown under "Denied" (controlled); uncontrolled, the reason typed in the reason step. |
| onApprove? | () => void | Called when Approve is pressed. |
| onDeny? | (reason: string | undefined) => void | Called when the request is denied, with the reason typed (trimmed), or undefined when none was given. |
| askReason? | boolean = false | A press on Deny first opens an optional reason field, sent with the denial. |
| labels? | Partial<ApprovalRequestLabels> | The words it says, any of them replaced. |
- Types: ApprovalRequestLabels = { approve: string; deny: string; cancel: string; reason: string; reasonPlaceholder: string; pending: string; approved: string; denied: string }
- data-slot values (to select a part by): approval-request, approval-request-actions, approval-request-message, approval-request-panel, approval-request-status
Keyboard
| Key | What it does |
|---|---|
| Tab | Move from Deny to Approve (in the reason step: the field, Cancel, then Deny) |
| Enter Space | On Approve or Deny: decide, the decided line taking the focus and the decision said politely; with askReason, Deny first shows the optional reason field, focused |
| Enter | In the reason field: deny with the typed reason (Shift+Enter breaks the line) |
| Escape | In the reason field: back to the question, the focus on Deny, nothing sent |
Accessibility
- The part itself answers the keys above.
- focus-visible: the browser's own (:focus-visible): write nothing
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.