Loading component…
Loading component…
An agent's question, asked the way Claude asks one – its own card above the chat composer with numbered options, Approve / Decline, previews and a row for your own words
To reuse this local React demo, copy all files from the Code tab into the same folder, then import DecisionCard from ./decision-card.
import { DecisionCard, type Decision } from "@/components/ui/decision-card";
const decisions: Decision[] = [
{
id: "queue",
task: "Ingest pipeline",
question: "Which queue should the ingest service use?",
options: [
{ id: "kafka", title: "Kafka", summary: "A durable log – a day of events to replay", recommended: true },
{ id: "sqs", title: "SQS", summary: "Managed, nothing to run – but no replay" },
{ id: "pg", title: "Postgres queue", summary: "The database you already have" },
],
},
];
export function Chat() {
const [open, setOpen] = useState(decisions);
return (
<>
<DecisionCard
decisions={open}
onDecide={(id, answer) => {
agent.answer(id, answer);
setOpen((l) => l.filter((d) => d.id !== id));
}}
/>
<Composer />
</>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| decisions | Decision[] | The open decisions, oldest first – an answered one leaves the card at once; drop it from the array in onDecide | |
| onDecide | (id: string, answer: DecisionAnswer) => void | An answer: { option } for a row or tile, { text } for your own words, "approve" or "decline" | |
| onLater | (id: string) => void | Later or Esc folded the card to one line | |
| defaultFolded | boolean | false | Start folded to "2 decisions waiting · Show" |
| reveal | number | Change it to bring the card up – it unfolds, pulses gray once and focuses the selected row | |
| labels | Partial<DecisionCardLabels> | Every text, e.g. needsYou, later, show, recommended, approve, decline, own, waiting(n), of(i, n) | |
| className | string | Extra class on the root |
A gray layer with the head on it and a white card with the rest – it takes the width of your composer
Long titles and fact values wrap to a second line, then end in …; summaries and the task stay on one line – nothing leaves the card on phones
One or two tiles keep the size of three; below 420px the tiles turn into rows
On touch screens rows are 44px tall and buttons 32px to see, 40px to hit
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"