Comparison
Show choices side by side and highlight the evidence behind a recommendation.
Personal
For individual projects
- Projects
- 3
- Members
- 1
- Export data
- Included
Team
For shared projects
- Projects
- Unlimited
- Members
- 10
- Export data
- Included
Pass columns and rows. Control highlights from your own state.
Installation
Add the registry entry to your app.
npx shadcn@latest add @fabrials/comparisonWithout the named registry, use the address:
https://ui.fabrials.com/r/comparison.json
API reference
| Prop / export | Type | Description |
|---|---|---|
columns | ComparisonColumn[] | Stable IDs, titles, visuals and optional actions. recommended: true marks the option the evidence points to (a Stormlight edge and a Best fit label). |
rows | ComparisonRow[] | Values by column ID; highlight relevant evidence. |
caption | string | Accessible table description. |
note | ReactNode | Visible explanation of the current highlights. |
Behavior
Controlled presentation. Register application-specific comparison tools with useWebMCPTool; use the same state for human controls and agent actions.
Accessibility
Usage
Use stable column IDs as keys in each row’s values. Values, visuals and actions accept React nodes, so the same component can compare plans, products or settings.
import { Comparison } from "@/components/webmcp/comparison"; <Comparison caption="Plan features" columns={[ { id: "personal", title: "Personal" }, { id: "team", title: "Team", recommended: true }, ]} rows={[ { id: "members", label: "Members", values: { personal: "1", team: "10" }, highlighted: true, }, ]}/>;Composing a complete flow
Comparison renders the evidence. Your application owns selection, recommendation rules and any side effects; mark the column your rules point to with recommended, so people see which option the highlighted rows support. It does not register tools or change application state by itself.
The shopping example combines Comparison with WebMCP tools, a compatible accessory, shared cart state and human review. For a different use case, see the project explorer or reservation flow.