Skip to content
Tier

Decision row

Pro

A decision as one compact row, for a list of what needs the person: a kind tile, the title, a meta line (what it is about, what is paused, how long it has waited, what the agent recommends) and the answers inline on one line, with "Answer differently…" after them opening the app's own flow. Inbox's rows are single buttons, so a row with its own actions is this part, not an Inbox prop; for one decision with its facts, use DecisionCard.

The answers keep the app's order and the same weight, the recommended one marked "Agent’s pick". With emphasis="recommended", the recommended answer leads, first and as the primary button, only when the app says taking it spends nothing (spends: false) and it isn't destructive; otherwise nothing moves. This is DecisionCard's rule, through the same helpers (leadingChoice and arrangedChoices). None is focused or pre-selected and no key answers it. A destructive answer is drawn in the destructive tone with the app's words for what can and can't be undone tied to its button, and an answer that ends unfinished work says what. A choice's detail isn't drawn in a row: open the decision for it.

The row is a group named by its title, the title its own link (href) or button (onOpen) and the answers its siblings, never nested in it. In a list, put each row in an <li> of the app's <ul>. The kind is drawn as an icon in a tile and the kind's word in the meta line, never colour alone.

Markdown

Preview

Loading the preview

Install

With the Candor CLI

First time? Get started sets up the registry and theme. Or with shadcn directly: npx shadcn@latest add @candor/decision-row

Brings in: bidi, button, chat, decision-review, link, locale, locked, relative-time, tokens, utils · npm: lucide-react@^1.67.0

Usage

TSX · The example above
"use client"

import * as React from "react"
import { CircleDollarSign, KeyRound } from "lucide-react"
import { DecisionRow } from "@/components/candor/decision-row"

const kinds = {
  money: { label: "Spend", icon: CircleDollarSign, tone: "warning" as const },
  access: { label: "Access", icon: KeyRound, tone: "accent" as const },
}
const agent = { id: "builder", name: "Builder", role: "dev" }
const hoursAgo = (h: number) => new Date(Date.now() - h * 3_600_000).toISOString()

/**
 * Two rows in a list. The first answer that spends nothing may lead with emphasis="recommended"; the second row's
 * pick spends, so its answers keep the app's order and the same weight, the pick only marked.
 */
export default function Example() {
  const [answered, setAnswered] = React.useState<Record<string, string>>({})
  const choose = (row: string) => (choice: string) => setAnswered((was) => ({ ...was, [row]: choice }))
  return (
    <ul className="max-w-2xl divide-y rounded-xl border bg-card">
      <li>
        <DecisionRow
          title="Reconnect the test account?"
          href="#reconnect"
          kind="access"
          kinds={kinds}
          subject="Renewal board"
          paused="the deploy"
          since={hoursAgo(1)}
          agent={agent}
          choices={[
            { id: "later", label: "Later" },
            { id: "reconnect", label: "Reconnect…", spends: false },
          ]}
          recommended="reconnect"
          emphasis="recommended"
          pending={answered.access ?? null}
          onChoose={choose("access")}
          onAnswerDifferently={() => {}}
        />
      </li>
      <li>
        <DecisionRow
          title="The build reached its $20 budget"
          href="#budget"
          kind="money"
          kinds={kinds}
          subject="Renewal board"
          paused="the build"
          since={hoursAgo(3)}
          agent={agent}
          choices={[
            { id: "stop", label: "Finish with what’s done", spends: false },
            { id: "raise", label: "Raise to $40", spends: true },
          ]}
          recommended="raise"
          emphasis="recommended"
          pending={answered.money ?? null}
          onChoose={choose("money")}
          onAnswerDifferently={() => {}}
        />
      </li>
    </ul>
  )
}

<DecisionRow>

PropTypeDefaultDescription
titlerequiredstring—What is to be decided, in the app's words: "Raise the build's budget to $40?". Drawn as text.
hrefstring | undefined—Where the title opens the decision, the app's own address. With it, the title is a link.
onOpen(() => void) | undefined—Called when the title is pressed, when there is no `href`. With it, the title is a button.
kindstring | undefined—Which kind of decision it is: a key of `kinds`. A kind with no entry shows this key as it is.
kindsReadonly<Record<string, DecisionReviewKind>> | undefined—The app's kinds, by key: each one's word, icon and tone, as DecisionCard's.
subjectstring | undefined—What it is about, in the app's words ("Renewal board"): the meta line's first part.
pausedstring | undefined—What it has paused, in the app's words ("the deploy"), drawn as "Paused: the deploy".
sincestring | undefined—When it was asked, as an ISO time: "Asked 2 hours ago".
agentAgentIdentity | undefined—The agent whose pick `recommended` is, named by the app: "{agent} recommends: …".
choicesrequiredreadonly DecisionCardChoice[]—The answers, in the order to show them. Only a recommended answer that may lead (see `emphasis`) moves first.
recommendedstring | undefined—The id of the agent's recommended answer: marked, named in the meta line, never pre-selected.
emphasis"equal" | "recommended" | undefined"equal"How the recommended answer is drawn. "equal" (the default): the app's order, every answer with the same weight, the recommended one marked. "recommended": it leads, first and as the primary button, only when it says `spends: false` and isn't `destructive`; otherwise as "equal".
onChoose((choiceId: string) => void) | undefined—Called with the chosen answer's id.
onAnswerDifferently(() => void) | undefined—Shows "Answer differently…" after the answers; called when it's pressed. Open the app's own flow from here.
pendingstring | null | undefined—The id of the answer being recorded: its button is busy and every answer is locked until the app clears it.
lockedstring | null | undefined—Why the viewer can't answer here, if they can't; shown on every answer. `null` or left out: unlocked.
classNamestring | undefined—Classes, merged with Candor's.

Strings

The fixed words, in English by default. Change any of them under decisionRow in <LocaleProvider strings={{ … }}>; the table is exported as decisionRowStrings.

KeyEnglish
pausedPaused: {what}
sinceAsked {time}
recommends{agent} recommends: {choice}
recommendsUnnamedRecommended: {choice}
agentsPickAgent’s pick
answerDifferentlyAnswer differently…
recordingRecording your answer
undoable{choice}: {undoable}
ends{choice} ends these unfinished: {items}

Types from other items

The props above take these. Each is defined by another item; import it from the path shown.

AgentIdentity from @/lib/candor/chat
{ id: string; /** The displayed name, e.g. "Architect agent". Never derived from model output. */ name: string; role: AgentRole; specialty?: string | undefined; }
AgentRole from @/lib/candor/chat
What an agent does: "assistant", "coder", "reviewer"… The app registers each role's glyph and hue (AgentRolesProvider).
string