DocsComponentsTemplatesThemesGitHub

ApprovalCard

Human-in-the-loop request: what the agent wants to do, risk level, details, Deny / Always allow / Allow once.

Code

import * as React from 'react';
import { ApprovalCard } from '@fruit-labs/design';

export default function Demo() {
  return (
    <div
      style={{
        maxWidth: 520,
      }}
    >
      <ApprovalCard
        title="Run a command in your terminal?"
        description="The agent wants to install dependencies in /web."
        detail="npm install @stripe/stripe-js"
        risk="medium"
        {...{
          onApprove() {},
        }}
        {...{
          onDeny() {},
        }}
        {...{
          onAlwaysAllow() {},
        }}
      />
    </div>
  );
}

Install

From npm:

npm install @fruit-labs/design

import { ApprovalCard } from '@fruit-labs/design';

Or copy the TypeScript source into your project:

npx shadcn@latest add https://design.fruitlabs.online/r/approval-card.json

Guidelines

  • Say exactly what will happen and where. Show the command or payload in detail.
  • High risk uses a red frame and a red confirm; never auto-approve high risk.

Props

PropTypeRequired
titleReact.ReactNodeNo
descriptionReact.ReactNodeNo
detailstringNo
risk'low' | 'medium' | 'high'No
approveLabelstringNo
denyLabelstringNo
onApprove() => voidNo
onDeny() => voidNo
onAlwaysAllow() => voidNo
classNamestringNo

Edit this example on GitHub