---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Approval request

An 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.

Pro. Its export: `ApprovalRequest`.

## 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.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-approval-request.json --yes
```

```text
Add the Goop Approval request to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
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

### Options

- `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 }

## Keyboard

- 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.

## Related

- [Code block](/themes/trail/components/code-block): A block of code or a command with a copy button.
- [Tool call](/themes/trail/components/tool-call): One tool call of an AI agent's run, as a row that opens onto its input and output.
- [Card list](/themes/trail/components/card-list): A short list of rows inside an outline card, for what is recent, due or shared.
- [Citation](/themes/trail/components/citation): A source's small numbered chip inside an AI answer's words, right after the claim it backs.
