Answer compare
A React component in Beamline's AI & agents category.
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. Answers stream in their own columns with time, tokens and cost under each; in a blind test the models stay hidden behind A and B until the verdict, then turn over to show who wrote what. Narrow rooms switch between the two instead of squeezing them.
Use it for
- Choosing between two models, prompts or versions on the same input (a playground, an eval queue, a prompt review).
- Collecting a person's preference with reasons, blind or named.
Not for
- One answer in a conversation (message, response).
- Comparing two pictures (image-compare).
- Comparing plans or prices (plan-comparison).
Anatomy
- prompt: the input both answered, one line that opens to the whole
- columns: A and B, each with its name (A, B, or the model), the answer (streamed markdown, or your own drawing) and its facts: time, tokens, cost (not reported is said)
- narrow room: a switch between A and B above one column, each answer keeping its scroll
- verdict bar: A is better, Tie, B is better, Both are bad; the chosen one pressed, the better column ringed and the other quieter
- reasons: after a verdict, chips for why (More accurate, Clearer, Shorter, Follows the instructions, Safer…) and an optional note; Submit sends
- blind: model names hidden until the verdict; they turn over to show
Variants
- blind: true, false
States
- streaming
- ready
- chosen
- reasons
- submitted
- error (an answer that failed says so in its column)
Keyboard
- The verdict buttons are a group: ← → move, Enter or Space chooses; 1, 2, 3 and 4 choose from anywhere in the element
- The columns scroll with the page or on their own; with sync on they scroll together
- In a narrow room the switch is a segmented control
Motion
Each answer streams in its column at the response's even pace. Choosing rings the better column and quiets the other (a cross-fade), the reasons grow under the bar, and in a blind test the names turn over one after the other. Submitting folds the reasons into a line that says what was sent. Reduced motion: the names change in place, nothing turns.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
prompt | ReactNode | — | |
answers (required) | [CompareAnswer, CompareAnswer] | — | |
value / defaultValue / onValueChange | CompareVerdict | null | — | |
onSubmit | (verdict: CompareVerdict) => void | Promise<void> | — | With it, reasons and Submit follow the choice; a promise shows progress and a refusal keeps the choice. |
reasons | string[] | — | The reason chips. Default: More accurate, Clearer, More complete, Shorter, Follows the instructions, Safer. |
blind | boolean | — | Hide the models until the verdict. |
syncScroll | boolean | — | The columns scroll together. Default true. |
currency | string | — | Default "$". |
className / classNames / style / ref | root | — |
Built from
- response
- button
- chip-group
- segmented-control
- textarea
Dependencies
lucide-react
Import
import { AnswerCompare } from "@/components/answer-compare/answer-compare";
Get it
Answer compare is part of Beamline: 200+ components and 50+ complete screens for React that your coding agent (Claude Code, Codex, Cursor or any MCP client) installs into your app through Beamline's MCP server, as a ready-built package or as plain React source you can change. $49 launch price, one payment, no subscription, lifetime updates, one licence for your whole team. 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…
- 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…
- Recommendation card: 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…
- 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…