Skip to documentation content

Recommendation Card

Present one recommended action with its confidence stated, and keep the alternatives a press away.

recommendation-card-demo

Overview

Recommendation Card shows what an agent proposes to do, how sure it is, and what else it considered. The person accepts the recommendation or opens the alternatives and picks one of those.

Nothing happens until the person accepts. The card calls onAccept with the chosen option, and your application does the work.

Use Approval Card when the agent has questions to ask. Use this card when it has an answer to propose.

Anatomy

RecommendationCard
  • TitleThe question the agent is asking
  • BodyThe selected option in full
  • ConfidenceA three-bar meter with the confidence in words
  • AlternativesThe other options, behind a disclosure
  • AcceptA button named for the selected option

Installing recommendation-card brings Button and Collapsible along as registry dependencies.

Behavior

Options

The first option is the recommendation. Choosing an alternative makes it the selected option: the body, the confidence, and the accept button's text all change to match.

Confidence

confidence runs from 0 to 3 and fills the meter. confidenceLabel is always shown beside it. Take both from your agent. Do not present a guess as high confidence.

Accepting

If onAccept returns a promise, the button shows progress and the card locks until it settles. When it resolves, the card confirms and stays locked. When it rejects, the card shows an error and the person can accept again or pick another option.

Accessibility

The Alternatives button reports whether the list is expanded. Each alternative is a button. The body is a polite live region, so choosing an alternative announces the new recommendation.

The confirmation is a status and the error is an alert. The meter is decorative; the confidence is carried by its label.

KeyAction
TabMove across the alternatives, Alternatives, and the accept button
Enter or SpaceActivate the focused button

Installation

npx honestui@latest add https://ai.honestui.com/r/recommendation-card.json

Usage

import { RecommendationCard } from "@/components/ai/recommendation-card"

<RecommendationCard
  title="How should I fix the rounding drift?"
  options={proposal.options}
  onAccept={(option) => agent.accept(proposal.id, option.id)}
/>

Examples

An accept that fails

This preview rejects the first accept and resolves the second.

recommendation-card-failure

API reference

RecommendationCard

Accepts native div props beyond those listed.

PropTypeDefaultDescription
titlestringRequiredThe question the agent is asking.
optionsRecommendationOption[]RequiredThe recommendation first, then the alternatives.
onAccept(option) => void | Promise<void>RequiredReceives the chosen option.
labelsPartial<RecommendationCardLabels>EnglishButton names and outcome messages.

Types

ExportShape
RecommendationOptionid, body, summary, confidence (0 to 3), confidenceLabel, actionLabel