Recommendation card

A React component in Beamline's AI & agents category.

One suggestion from the agent that the person may take or leave: what it suggests, why, the expected effect and how sure it is (a meter and a word, hatched when it cannot tell), with the alternatives it weighed one click away; Accept runs your callback with progress and the card settles to one line.

Use it for

  • An agent proposing one next step the person may accept or skip, with its confidence and reasons.
  • Showing the alternatives the agent considered so the person can choose another.

Not for

Anatomy

  • header: icon tile, who suggests, the question
  • suggestion well: title, Suggested / caveat badges, description, reasons (checks), confidence meter (segments + word + %), expected effect
  • Other options (n): disclosure with every option as a radio row (title; Suggested, caveat and confidence in words)
  • failure alert with Retry
  • footer: Not now, Accept
  • settled record: Accepted / Dismissed and the suggestion, side by side or the suggestion under the decision when narrow; when it has a description, reasons or an impact it opens to show them
  • summary: the badges sit beside a short title and wrap under a long one

States

  • open
  • options shown
  • alternative chosen
  • confidence not scored (hatched, "Not scored")
  • pending (Accept or Not now shows progress, aria-busy)
  • error (alert, Retry)
  • accepted
  • dismissed

Keyboard

  • Tab: Other options toggle → options (arrow keys choose) → Not now → Accept
  • Closed options are out of the Tab order
  • Focus moves onto the settled line after a decision
  • Enter or Space on a settled record opens or closes what it decided on
  • A settled record is named by its visible decision and request; the configurable details cue is its accessible description.

Motion

The card's height eases to another option and down to its record (useHeightMorph). Choosing another option fades its title, description and reasons in where the last ones stood, and the confidence segments light or let go one after another; the alternatives open with .disclosure-panel; a failure grows into place; a decision made while watching folds the card to its record with a fade and the status mark settles in; the record opens with .disclosure-panel. Buttons show progress (Button). Reduced motion keeps the fades and drops the travel.

Props

PropTypeDefaultDescription
title / agent (required)ReactNode—title: The question the agent puts: "Want me to apply this renewal offer?" agent: Who suggests it. Default "The agent".
recommendations (required)Recommendation[]—The agent's pick first, then the alternatives it considered.
value / defaultValue / onValueChangestring—value: The option the person is looking at, controlled or not; defaults to the first. defaultValue: Initial chosen recommendation id; defaults to the first supplied recommendation. onValueChange: Reports id of the chosen recommendation after an edit; no callback by default.
onAccept / onDismiss(recommendation) => void | Promise—onAccept: Applies the chosen option. Return a promise: Accept shows progress, then the card settles; a refusal says why. onDismiss: Not now. Same promise contract.
decision / defaultDecision / onDecisionChange"accepted" | "dismissed" | null—decision: Controlled settled decision; null keeps the card pending; omit to use defaultDecision. defaultDecision: Initial recorded decision when uncontrolled. Defaults to null. onDecisionChange: Reports recorded decision after a change; no callback by default.
open / defaultOpen / onOpenChangeboolean—open: The other options open, controlled or not. defaultOpen: Initial open state when uncontrolled. Defaults to false. onOpenChange: Reports open state after a change; no callback by default.
labelsPartial<RecommendationCardLabels>—Suggestion, acceptance and dismissal text overrides; defaults to the built-in English labels.
style / refCSSProperties / native Ref—style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default.
classNamesRecommendationCardClassNames—Classes for the named visual parts; no part overrides by default.
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.
title (required)ReactNode—The question the agent puts: "Want me to apply this renewal offer?"
agentReactNode—Who suggests it. Default "The agent".
valuestring—The option the person is looking at, controlled or not; defaults to the first.
defaultValuestring—Initial chosen recommendation id; defaults to the first supplied recommendation.
onValueChange((id: string) => void)—Reports id of the chosen recommendation after an edit; no callback by default.
onAccept((recommendation: Recommendation) => void | Promise<unknown>)—Applies the chosen option. Return a promise: Accept shows progress, then the card settles; a refusal says why.
onDismiss((recommendation: Recommendation) => void | Promise<unknown>)—Not now. Same promise contract.
decisionRecommendationDecision | null—Controlled settled decision; null keeps the card pending; omit to use defaultDecision.
defaultDecisionRecommendationDecision | null—Initial recorded decision when uncontrolled. Defaults to null.
onDecisionChange((decision: RecommendationDecision | null) => void)—Reports recorded decision after a change; no callback by default.
openboolean—The other options open, controlled or not.
defaultOpenboolean—Initial open state when uncontrolled. Defaults to false.
onOpenChange((open: boolean) => void)—Reports open state after a change; no callback by default.
classNamestring—Classes on the documented visual root; no override by default.
refRef<HTMLElement>—Receives the documented root element; no ref by default.

Built from

Dependencies

lucide-react, radix-ui

Import

import { RecommendationCard } from "@beamline/recommendation-card";

Get it

Recommendation card is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent

More in AI & agents

  • Image generation: The frame an AI image is generated into: a field of brand-hued pixels breathes with the progress while the model works, then the image arrives —…
  • Flowchart: A workflow as steps on a dotted canvas: a trigger, conditions that branch into paths side by side, actions and waits, read top to bottom; during a run…
  • Run trace: One agent run as a waterfall: every step (model calls, tools, retrieval, checks, sub-agents) nested under the step that started it, each a bar on a…
  • Run theatre: One agent run as a theatre: the Run trace's waterfall under a transport (play, scrub, speed) that replays the run as it happened. Pick a step and re-run…
  • Answer compare: Two answers to the same prompt side by side, and a person's verdict: A is better, a tie, B is better, or both are bad, with the reasons that decided it…
  • Branch navigator: The versions of an assistant conversation that forked when a message was edited or an answer regenerated: a “‹ 2 / 3 ›” switch on each message that has…
  • Response: An assistant's answer as streamed markdown in the system's reading type: bursty tokens flow in at an even pace, each new word fades in through a short…
  • Chat thread: People talking to people: messages grouped by person and day, reactions, delivery and read receipts that glide to the newest message read, who is typing…
  • Model picker: Choose the AI model for a request by what it can do and what it costs: a trigger with the model's name opens a searchable list grouped by provider, with…
  • Task rows: Background work an agent is doing, one row per task: status as a glyph and a word, what it produced, how long it has run or took, a progress bar while…
  • Conversation: The scrolling column of a conversation: follows new content while you are at the bottom, stops when you scroll up to read, and offers a way back; shared…
  • Context cards: The knowledge an agent retrieved before it answered: one card per chunk with what it is about, the text it read with the search words marked, how…
  • Prompt suggestions: Ready-made prompts a person can start from or follow up with: chips, cards or a list; a picked one lifts off and flies into the composer as its text…
  • Plan: An agent's plan: numbered steps with live status, progress, and Approve / Edit / Reject when it needs sign-off; approving shows progress, and a refusal…
  • Approval card: The agent stops and asks before it acts: what it wants to do, exactly what that changes, any choices it needs, and Approve or Reject; both run your…
  • Tool call: One tool call in an agent's run: status, what it did and a short result on one quiet row that opens to the exact input and output; stops for permission…
  • Citations: Inline numbered citations that preview their source on hover or focus, plus a numbered source list; streamed answers flow in at an even pace with the…
  • Reasoning: The agent's trace, fed by your stream: a shimmering label and the seconds so far while it works, then "Thought for N seconds"; steps that check off…
  • Attachment: A file tile: preview or typed glyph with the type named, name, size, upload progress, error with retry, and a keyboard-reachable remove.
  • Prompt bar: The agent composer: a field that grows, @ to add a source, / for a command, a model picker, files and dictation, and one button that sends with progress…
  • Selection actions: Select a passage and hand it to the agent: a bar over the selection with quick actions, your own instruction and More; while the agent works it says so…
  • Message: One turn in a conversation with an agent: the person's words in a quiet bubble, the agent's answer on the page with its orb mark, trace, tool calls and…

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.