Command Palette

Search for a command to run...

AI Elements / Agentic/AI Confirmation

AI Confirmation

Human-in-the-loop tool approval workflow with accept/reject states for agentic AI applications.

Open in v0Open in

Overview

A compound component for human-in-the-loop AI workflows. Displays approval requests with approve/reject actions and shows the result state. Essential for agentic AI systems that require user confirmation before executing sensitive operations.

Installation

bunx shadcn@latest add @elements/confirmation

Usage

import {
  Confirmation,
  ConfirmationRequest,
  ConfirmationAccepted,
  ConfirmationRejected,
  ConfirmationActions,
} from "@/components/elements/ai-elements/agentic/confirmation";
import { useState } from "react";

export function ConfirmationExample() {
  const [state, setState] = useState<ConfirmationState>("approval-requested");

  return (
    <Confirmation
      state={state}
      onApprove={() => setState("output-available")}
      onReject={() => setState("output-denied")}
    >
      <ConfirmationRequest
        title="Delete Files"
        description="The AI wants to delete 3 temporary files from your project."
      >
        <ConfirmationActions />
      </ConfirmationRequest>
      <ConfirmationAccepted description="Files have been deleted." />
      <ConfirmationRejected description="Operation was cancelled." />
    </Confirmation>
  );
}

Props

Confirmation

PropTypeDefaultDescription
stateConfirmationState-Current confirmation state
onApprove() => void-Callback when approved
onReject() => void-Callback when rejected

ConfirmationState

type ConfirmationState =
  | "approval-requested"
  | "approval-responded"
  | "output-available"
  | "output-denied";

ConfirmationRequest / Accepted / Rejected

PropTypeDefaultDescription
titlestringVariesHeader title
descriptionstring-Description text

ConfirmationAction

PropTypeDescription
variant"approve" | "reject"Button variant
onClick() => voidAdditional click handler

Features

  • Context-based conditional rendering
  • Alert-based accessible design
  • Approve/Reject buttons with icons
  • State-aware color theming
  • Customizable action buttons