Components

ApprovalCard

Human-in-the-loop approval card with approve/reject controls and risk-level styling.

Category: AI / Chat / Standalone

Import

import {
  ApprovalCard,
  type ApprovalCardProps,
  type ApprovalStatus,
  type ApprovalRisk,
} from "@hareru/ui"

Exports

NameTypeDescription
ApprovalCardComponentApproval card
ApprovalCardPropsTypeProps interface
ApprovalStatusType"pending" | "approved" | "rejected" | "expired"
ApprovalRiskType"low" | "medium" | "high"

Key Props

PropTypeDefaultDescription
titlestringCard title (required)
descriptionstringDescription text
statusApprovalStatus"pending"Current status
riskApprovalRisk"low"Risk level (affects visual styling)
onApprove() => voidApprove handler (button shown only when provided and status is "pending")
onReject() => voidReject handler (button shown only when provided and status is "pending")
approveLabelstring"Approve"Approve button label
rejectLabelstring"Reject"Reject button label

States

StateTypeValuesDefaultCSS Reflection
statusenumpending | approved | rejected | expiredpending
riskenumlow | medium | high

Accessibility

  • Roles: alert, region
  • Keyboard:
    • Tab to navigate action buttons
  • Notes: role="alert" when status is pending, role="region" otherwise.

Usage

import { ApprovalCard } from "@hareru/ui"

// Pending with actions
<ApprovalCard
  title="Delete 3 records from orders table"
  description="This action will permanently remove the selected records."
  status="pending"
  risk="high"
  onApprove={() => console.log("approved")}
  onReject={() => console.log("rejected")}
/>

// Approved (no action buttons)
<ApprovalCard
  title="Update user email"
  status="approved"
  risk="low"
/>

// Rejected
<ApprovalCard
  title="Drop staging database"
  status="rejected"
  risk="high"
/>

Notes

  • Action buttons are only rendered when status is "pending".
  • When status is "pending", the card uses role="alert" to announce to screen readers. Otherwise, it uses role="region".
  • Risk level affects BEM modifier classes: hui-approval-card--risk-low, hui-approval-card--risk-medium, hui-approval-card--risk-high.
  • In DOM order, the reject button is rendered before the approve button.

On this page