Skip to content

@pgege/kaboo-react


Function: useApprovalDecision()

useApprovalDecision(__namedParameters): ApprovalDecisionControls

Defined in: src/components/ApprovalActions.tsx:59

The standard approval decisions for a card: which scopes to offer, the deadline, and approve / deny / dismiss bound to the request. Use it to build a custom approval card that behaves like the built-in one, or render ApprovalActions for the standard buttons.

Parameters

__namedParameters

InterruptRendererProps\<ApprovalReason>

Returns

ApprovalDecisionControls

Example

import { useApprovalDecision, type ApprovalReason, type InterruptRendererProps } from "@pgege/kaboo-react";

function OneClickApproval(props: InterruptRendererProps<ApprovalReason>) {
  const decision = useApprovalDecision(props);
  if (decision.responded) return <p>Sent.</p>;
  return <button onClick={() => decision.approve("once")}>Approve {props.reason.tool_name}</button>;
}