Comparison table
Us-versus-them feature comparison matrix with a highlighted product band, frosted sticky header, drawn check marks, differences-only collapse, morphing CTA, and a stacked phone competitor picker.
import { ComparisonTable } from '@uthereal/ui/comparison-table'Comparison table playground
How Relay compares
Showing rows where every product agrees
Overview
ComparisonTable contrasts your product against up to five alternatives across grouped feature sections. Marking one column with highlight: true paints a continuous tinted band from its rounded header to its footer CTA, with staggered check marks that draw into view down the column.
A Differences only switch collapses matching rows—and hides any section whose rows all match—so readers can focus on gaps. Below stackBelow (640px by default), the matrix collapses cleanly into a two-column view pairing your product with a morphing pill selector for switching competitors one at a time.
Use ComparisonTable on pricing, alternatives, or deployment-model pages. For comparing your own pricing tiers with a monthly/yearly toggle, use Plan comparison.
Usage
'use client'
import { ComparisonTable } from '@uthereal/ui/comparison-table'
export function AlternativesMatrix() {
return (
<ComparisonTable
maxHeight="min(720px, 80vh)"
cta={{
label: 'Start free trial',
action: 'start_comparison_trial',
doneLabel: 'Trial started',
}}
onAction={(action) => {
console.log('Triggered action:', action)
}}
/>
)
}Omit columns and sections to render the built-in four-column sample matrix with local filter, phone competitor picker, and CTA morph state (nothing leaves the browser).
Examples
Sticky scroll with differences filter and action CTA
Combine defaultDifferencesOnly, a numeric maxHeight, and an action cta with doneLabel to keep the frosted column header pinned inside a keyboard-scrollable container while hiding identical rows.
How Relay compares
Shared capabilities are collapsed so only meaningful product gaps remain visible.
Hiding rows where every product agrees
Head-to-head comparison with link CTA
Configure two columns and a link cta (href) for focused deployment or migration comparisons, using "partial" cells with qualifier notes alongside text values.
Managed Cloud vs Self-Hosted
Compare operational ownership and compliance defaults before migrating.
Showing rows where every product agrees
Cell values and responsive stacking
Cell value types
| Value shape | Visual mark | Screen-reader text |
|---|---|---|
true | Circular check mark (accent-filled in your column). | includedLabel |
'partial' | Half-filled circle with optional qualifier note. | partialLabel + note |
false (or omitted column ID) | Muted em dash (—). | notIncludedLabel |
| Non-empty string (≤ 80 chars) | Tabular text value (weighted in your column). | Literal string text |
Wide vs stacked phone view
When the container width drops below stackBelow (default 640px), ComparisonTable renders only your highlighted column and one competitor column, mounting a horizontal competitor pill bar above the table. Switching competitors crossfades the header and every cell in place while recalculating Differences only against the two visible columns.
API reference
These serializable arguments and defaults come directly from the component schema.
| Argument | Type / default | Description |
|---|---|---|
title | stringDefault: "How Relay compares" | Heading and accessible section name. |
description | string— | Supporting line below the heading. Pass an empty string (or null in React) to hide it. |
columns | ComparisonColumn[]Default: [{"id":"relay","name":"Relay","caption":"$10 per seat","highlight":true},{"id":"suite","name":"Legacy suite","caption":"$24 per seat","highlight":false},{"id":"sheets","name":"Spreadsheets","caption":"Free","highlight":false},{"id":"point","name":"Point tools","caption":"$16 per seat","highlight":false}] | The compared products in order: id, name, optional caption (such as a price), and highlight on your own product. Defaults to four sample columns. |
sections | ComparisonSection[]Default: [{"id":"planning","title":"Planning","rows":[{"id":"projects","feature":"Projects","values":{"relay":"Unlimited","suite":"Up to 50","sheets":"Unlimited","point":"Up to 10"}},{"id":"roadmaps","feature":"Timelines and roadmaps","values":{"relay":true,"suite":true,"sheets":false,"point":{"value":"partial","note":"Timeline only"}}},{"id":"dependencies","feature":"Dependencies","hint":"Blocked work moves when its blocker does","values":{"relay":true,"suite":true,"sheets":false,"point":false}},{"id":"templates","feature":"Templates","values":{"relay":true,"suite":true,"sheets":{"value":"partial","note":"Manual copies"},"point":true}}]},{"id":"collaboration","title":"Collaboration","rows":[{"id":"realtime","feature":"Real time editing","values":{"relay":true,"suite":false,"sheets":true,"point":true}},{"id":"guests","feature":"Free guest access","values":{"relay":true,"suite":false,"sheets":true,"point":{"value":"partial","note":"Five guests"}}},{"id":"comments","feature":"Comments and mentions","values":{"relay":true,"suite":true,"sheets":true,"point":true}},{"id":"offline","feature":"Offline mode","hint":"Edits sync when you reconnect","values":{"relay":true,"suite":false,"sheets":{"value":"partial","note":"Desktop app only"},"point":false}}]},{"id":"automation","title":"Automation","rows":[{"id":"rules","feature":"Rules and triggers","values":{"relay":true,"suite":true,"sheets":false,"point":{"value":"partial","note":"Paid add on"}}},{"id":"ai","feature":"AI summaries","values":{"relay":true,"suite":false,"sheets":false,"point":false}},{"id":"api","feature":"Public API","values":{"relay":true,"suite":true,"sheets":true,"point":true}}]},{"id":"security","title":"Security","rows":[{"id":"sso","feature":"SAML single sign on","values":{"relay":true,"suite":true,"sheets":{"value":"partial","note":"Enterprise plan"},"point":false}},{"id":"audit","feature":"Audit log","values":{"relay":true,"suite":true,"sheets":false,"point":false}},{"id":"residency","feature":"EU data residency","values":{"relay":true,"suite":{"value":"partial","note":"Enterprise plan"},"sheets":true,"point":false}}]}] | Titled feature sections with their rows: id, title, and 1 to 20 rows, each row carrying values keyed by column id (true, false, "partial", or text, optionally with a note). Defaults to four sample sections. |
defaultDifferencesOnly | booleanDefault: false | Initial differences-only filter state. Edits do not reset a mounted instance. |
defaultCompareWith | string— | Competitor shown beside yours in the stacked phone view on first render; defaults to the first non-highlighted column. |
cta | ComparisonCta— | Call to action in your column: a label plus either href (a link) or action (a host action that can morph to doneLabel after activation). Omit for no CTA. |
stickyTop | numberDefault: 0 | Offset of the sticky header under a fixed site header, px. 0 sticks to the scroller top. |
maxHeight | integer— | Cap the table height and scroll it inside the block, px (160 to 4000). Omitted lets the page scroll. |
stackBelow | integerDefault: 640 | Container width below which the table stacks into your product plus one competitor, px. Defaults to 640. |
differencesLabel | stringDefault: "Differences only" | Label of the switch hiding rows where every column agrees. |
includedLabel | stringDefault: "Included" | Legend and screen-reader text for a true cell. |
partialLabel | stringDefault: "Partial" | Legend and screen-reader text for a "partial" cell. |
notIncludedLabel | stringDefault: "Not included" | Legend and screen-reader text for a false cell. |
legendLabel | stringDefault: "Legend" | Accessible name of the legend row. |
compareWithLabel | stringDefault: "Compare {product} with" | Phone-view selector group label; {product} fills your product name. |
differencesAnnouncement | stringDefault: "{state} rows where every product agrees" | Polite status template when the differences filter changes; {state} fills "Showing" or "Hiding". |
recipe | studio | softDefault: "studio" | Visual treatment. Both recipes preserve interaction behavior. |
theme | ComparisonTableThemeDefault: {} | Color mode, accent, and typed semantic token overrides. |
motion | none | subtle | expressiveDefault: "subtle" | Animation preset. System reduced-motion preferences take precedence. |
motionOptions | ComparisonTableMotionOptionsDefault: {} | Row collapse, check draw, and CTA morph timing overrides in milliseconds. |
dir | ltr | rtl— | Reading direction; inherited from the page when omitted. |
ComparisonColumnaccepts{ id, name, caption?, highlight? }. Column IDs must be unique and at most one column can sethighlight: true.ComparisonSectionaccepts{ id, title, rows }(1 to 20 rows), where eachComparisonRowis{ id, feature, hint?, values }keyed by column ID. Section and row IDs must be unique across the table.ComparisonCtaaccepts{ label, href?, action?, doneLabel? }. Supplyhreforaction, never both.
React integration
| Prop | Purpose |
|---|---|
maxHeight | Accepts a schema number (160–4000 px) or any CSS length string (for example min(760px, 82vh)). |
differencesOnly, onDifferencesOnlyChange | Controlled differences-filter state and change callback. |
compareWith, onCompareWithChange | Controlled competitor column ID in stacked phone view and change callback. |
onCtaClick() | Called when a button CTA is activated (links navigate directly). |
onAction(action) | Called with cta.action when an action CTA is activated. |
preset | Application defaults overridden by explicit instance arguments. |
tokens | CSS variables applied after the typed theme, forwarded to root, switch, and CTA button. |
ref, className, style | Applied to the root <section> element. |
| Native attributes | id, aria-*, data-*, and remaining <section> props forwarded to the root element. |
Keyboard & accessibility
| Key | Action |
|---|---|
Tab | Moves across Differences only, phone competitor pills, scroll region, and CTA. |
Enter / Space | Toggles Differences only, picks a competitor pill, or activates the CTA. |
ArrowUp / ArrowDown | Scrolls the table body when maxHeight creates a focusable scroll region. |
- The matrix uses semantic
role="table",role="rowgroup",role="row",role="columnheader",role="rowheader", androle="cell"roles; every check, partial circle, and dash pairs anaria-hiddenmark with visually hidden text so meaning never depends on shape or color alone. - When
maxHeightis set, the scroll wrapper becomes a keyboard-focusablerole="region"(tabIndex={0}) labelled with the table title. - Phone competitor picker buttons expose explicit
aria-pressedstates inside a labelledrole="group", and a pre-mountedrole="status"live region announces filter changes (and when all visible rows match). - Container queries tighten ratios below
820pxand gutters below640px. Logical CSS properties mirror cleanly in RTL (dir="rtl"), touch devices mirror row hover on:active, and@media (forced-colors: active)maps the highlighted column band, check strokes, and borders to high-contrast system colors.
Motion & theming
Included check marks in your highlighted column draw their stroke once on scroll (whileInView) with a capped per-row stagger, filtered rows and emptied section headers collapse height on the smooth spring (0.4s, zero overshoot), competitor swaps crossfade on the snappy spring, and the phone picker highlight glides on a shared layoutId morph spring.
Under prefers-reduced-motion: reduce, check draws, height springs, backdrop blur, and CTA press scales turn off while swaps keep 120ms opacity fades. Setting motion="none" makes every transition immediate (0ms).
theme accepts mode, accent, and typed tokens across these groups:
| Token group | CSS custom properties |
|---|---|
core | --ui-surface, --ui-surface-raised, --ui-text, --ui-text-secondary, --ui-muted, --ui-border, --ui-highlight, --ui-accent, --ui-accent-foreground, --ui-danger, --ui-focus-ring, --ui-radius, --ui-border-width, --ui-shadow, --ui-disabled-opacity, --ui-font, --ui-font-size, --ui-font-weight |
extended | --ui-surface-sunken, --ui-border-strong, --ui-border-subtle, --ui-track, --ui-info, --ui-success, --ui-warning, --ui-tone-foreground, --ui-overlay, --ui-tint-strength |
shape | --ui-radius-sm, --ui-popup-radius, --ui-surface-radius |
accentTones | --ui-accent-strong, --ui-accent-subtle |
selectionControl | --ui-control-on, --ui-control-glyph, --ui-track, --ui-control-track-hover, --ui-control-thumb, --ui-control-thumb-on, --ui-control-fill, --ui-shadow-thumb |
control | --ui-control-height, --ui-control-padding-x, --ui-control-gap, --ui-icon-size |
An application-wide UtherealProvider supplies defaults.
Composition
In an agent composition, ComparisonTable is a leaf block. Mark exactly one column with highlight: true, key every row's values map by column ID, and wire cta.action only to a registered host action (or use cta.href for navigation). See Building with agents.
{
"type": "ComparisonTable",
"props": {
"title": "How Relay compares",
"defaultDifferencesOnly": false,
"maxHeight": 560,
"cta": {
"label": "Start free trial",
"action": "start_comparison_trial",
"doneLabel": "Trial started"
}
},
"children": []
}