Rendyn

Component library

189 components

Agent UI

Tool Approval

Tool Approval presents intent and decision callbacks for an application-controlled permission workflow.

Interactive exampleReact Tailwind CSS

Practical React example

Ask for permission to run one identified tool with visible parameters.

Before you copy and paste

Keep the example in the React rendering environment required by the imported component. Copy components/agents/tool-approval.tsx and its returned support files from the Code tab; preserve the project-relative paths.

Listed package dependencies: clsx, lucide-react, motion, react, shiki, tailwind-merge.

Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.

Ask for permission to run one identified tool with visible parameters

// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";

import { RotateCcw } from "lucide-react";
import { useCallback, useEffect, useRef, useState } from "react";
import {
  ToolApproval,
  ToolApprovalCode,
  type ToolApprovalStatus,
} from "@/components/agents/tool-approval";

export function ToolApprovalPreview() {
  const [status, setStatus] = useState<ToolApprovalStatus>("pending");
  const [detailsOpen, setDetailsOpen] = useState(true);
  const timers = useRef<number[]>([]);

  const clearTimers = useCallback(() => {
    timers.current.forEach(window.clearTimeout);
    timers.current = [];
  }, []);

  useEffect(() => () => clearTimers(), [clearTimers]);

  const finish = (next: ToolApprovalStatus) => {
    clearTimers();
    setStatus(next);
  };

  const approve = () => {
    clearTimers();
    setStatus("approving");
    timers.current = [
      window.setTimeout(() => setStatus("approved"), 600),
      window.setTimeout(() => setStatus("running"), 1150),
      window.setTimeout(() => setStatus("complete"), 2200),
    ];
  };

  const replay = () => {
    clearTimers();
    setStatus("pending");
    setDetailsOpen(true);
  };

  return (
    <div className="relative h-[360px] w-full max-w-lg">
      <ToolApproval
        tool="terminal.run"
        title={status === "pending" ? "Allow this tool to run?" : "Terminal access"}
        description="The agent wants to run the project test suite in the current workspace."
        status={status}
        open={detailsOpen}
        onOpenChange={setDetailsOpen}
        parameters={[
          {
            id: "command",
            label: "Command",
            value: (
              <ToolApprovalCode
                code="bun test tests/a11y.test.tsx"
                language="bash"
              />
            ),
          },
          { id: "directory", label: "Directory", value: "ui-components" },
        ]}
        onApprove={approve}
        onAlwaysAllow={approve}
        onDeny={() => finish("denied")}
      />
      <button
        type="button"
        onClick={replay}
        className="absolute bottom-0 left-0 inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
      >
        <RotateCcw className="size-3" />
        Replay
      </button>
    </div>
  );
}

Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.

Bind the approval to the exact tool, arguments and proposal revision on the server. Update the status only from the recorded decision and execution state.

Customization

ToolApprovalCodeProps.code
Required; string.
ToolApprovalCodeProps.language
Optional; AgentCodeLanguage.
ToolApprovalCodeProps.className
Optional; string.
ToolApprovalProps.tool
Required; ReactNode.
ToolApprovalProps.title
Optional; ReactNode.
ToolApprovalProps.description
Optional; ReactNode.
ToolApprovalProps.parameters
Optional; ToolApprovalParameter[].
ToolApprovalProps.status
Optional; ToolApprovalStatus.
ToolApprovalProps.open
Optional; boolean.
ToolApprovalProps.defaultOpen
Optional; boolean.
ToolApprovalProps.onOpenChange
Optional; (open: boolean) => void.
ToolApprovalProps.onApprove
Optional; () => void.
ToolApprovalProps.onAlwaysAllow
Optional; () => void.
ToolApprovalProps.onDeny
Optional; () => void.

Integration notes

  • A client-side approved flag is not an authorization token.
  • Always Allow must have an explicit scope, duration and revocation mechanism in the application; hiding a button is not a policy.

Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.

Better with your agent

Give your agent taste.

The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.

All components are free. Sign up only to connect MCP.

Connect to MCP