Comparison
Table that compares plans or options feature by feature. Each column is an arc-comparison-column child element.
<arc-comparison>Overview
Comparison draws a grid with one row per feature and one column per plan. Pass the row labels to features as a JSON array. Each <arc-comparison-column> adds a column with a heading and a values array in the same order as the features.
A value of "true" renders a check mark and "false" a cross, each with an accessible name of "Yes" or "No". Any other string, such as "5 GB" or "Unlimited", is shown as text. A missing value leaves the cell blank. Use it for pricing tables and plan comparisons. For data people sort and filter, use DataGrid.
Guidelines
Do
- Keep feature labels short. Long ones squeeze the value columns
- Highlight one column at most, usually the plan you recommend
- Give `features` and every column's `values` the same length
Don't
- Don't mix check marks and text in one row. Pick one format per feature
Features
- `highlight` on a column gives its header and every cell an accent background
- Rows highlight on hover
- Uses `table`, `row`, `rowheader`, `columnheader` and `cell` roles
- Every column gets an equal share of the width, and the feature column never goes below 140px
- A malformed `features` value falls back to an empty list without throwing
- CSS parts: `table`, `header`, `feature`, `cell`
Preview
Usage
Comparison is in the marketing group, so the default @arclux/arc-ui entry point doesn't include it. Import it from@arclux/arc-ui/marketing or from its own subpath,@arclux/arc-ui/comparison.
<arc-comparison features='["Storage","Bandwidth","Custom Domain","Priority Support"]'>
<arc-comparison-column
heading="Free"
values='["5 GB","10 GB","false","false"]'>
</arc-comparison-column>
<arc-comparison-column
heading="Pro"
highlight
values='["100 GB","Unlimited","true","true"]'>
</arc-comparison-column>
<arc-comparison-column
heading="Enterprise"
values='["Unlimited","Unlimited","true","true"]'>
</arc-comparison-column>
</arc-comparison>import { Comparison, ComparisonColumn } from '@arclux/arc-ui-react';
function PricingTable() {
const features = JSON.stringify(['Storage', 'Bandwidth', 'Custom Domain', 'Support']);
return (
<Comparison features={features}>
<ComparisonColumn heading="Free" values='["5 GB","10 GB","false","false"]' />
<ComparisonColumn heading="Pro" highlight values='["100 GB","Unlimited","true","true"]' />
<ComparisonColumn heading="Enterprise" values='["Unlimited","Unlimited","true","true"]' />
</Comparison>
);
}<script setup>
import { Comparison, ComparisonColumn } from '@arclux/arc-ui-vue';
const features = JSON.stringify(['Storage', 'Bandwidth', 'Custom Domain', 'Support']);
</script>
<template>
<Comparison :features="features">
<ComparisonColumn heading="Free" values='["5 GB","10 GB","false","false"]' />
<ComparisonColumn heading="Pro" highlight values='["100 GB","Unlimited","true","true"]' />
<ComparisonColumn heading="Enterprise" values='["Unlimited","Unlimited","true","true"]' />
</Comparison>
</template><script>
import { Comparison, ComparisonColumn } from '@arclux/arc-ui-svelte';
const features = JSON.stringify(['Storage', 'Bandwidth', 'Custom Domain', 'Support']);
</script>
<Comparison {features}>
<ComparisonColumn heading="Free" values='["5 GB","10 GB","false","false"]' />
<ComparisonColumn heading="Pro" highlight values='["100 GB","Unlimited","true","true"]' />
<ComparisonColumn heading="Enterprise" values='["Unlimited","Unlimited","true","true"]' />
</Comparison>import { Component } from '@angular/core';
import { Comparison, ComparisonColumn } from '@arclux/arc-ui-angular';
@Component({
imports: [Comparison, ComparisonColumn],
template: `
<arc-comparison [features]="features">
<arc-comparison-column heading="Free" values='["5 GB","10 GB","false","false"]' />
<arc-comparison-column heading="Pro" highlight values='["100 GB","Unlimited","true","true"]' />
<arc-comparison-column heading="Enterprise" values='["Unlimited","Unlimited","true","true"]' />
</arc-comparison>
`,
})
export class PricingComponent {
features = JSON.stringify(['Storage', 'Bandwidth', 'Custom Domain', 'Support']);
}import { Comparison, ComparisonColumn } from '@arclux/arc-ui-solid';
const features = JSON.stringify(['Storage', 'Bandwidth', 'Custom Domain', 'Support']);
<Comparison features={features}>
<ComparisonColumn heading="Free" values='["5 GB","10 GB","false","false"]' />
<ComparisonColumn heading="Pro" highlight values='["100 GB","Unlimited","true","true"]' />
<ComparisonColumn heading="Enterprise" values='["Unlimited","Unlimited","true","true"]' />
</Comparison>import { Comparison, ComparisonColumn } from '@arclux/arc-ui-preact';
const features = JSON.stringify(['Storage', 'Bandwidth', 'Custom Domain', 'Support']);
<Comparison features={features}>
<ComparisonColumn heading="Free" values='["5 GB","10 GB","false","false"]' />
<ComparisonColumn heading="Pro" highlight values='["100 GB","Unlimited","true","true"]' />
<ComparisonColumn heading="Enterprise" values='["Unlimited","Unlimited","true","true"]' />
</Comparison>API
featuresstring[][]- Feature label strings, one row each. Settable as a property, or as a JSON array in markup:
features='["Storage","Bandwidth"]'. A malformed value falls back to an empty list rather than throwing.
ComparisonColumn
<arc-comparison-column>One column of a Comparison. It renders nothing itself: the parent reads its heading, highlight and values.
headingstring''- Column header text displayed at the top of this column (e.g., "Free", "Pro").
highlightbooleanfalse- When true, adds an accent background to the header and all cells in this column.
valuesstring[][]- Values matching the features order. Settable as a property, or as a JSON array in markup. Use "true"/"false" for check/cross icons, or any string for text values.
See also
- Data GridGrid for tabular data with inline editing, multi-column sorting, pinned columns, row selection and virtual scrolling. Columns are a JavaScript array, and the whole grid is one tab stop with the WAI-ARIA grid keyboard pattern.
- CardContent container with a border and hover effects. When it links somewhere, the whole surface is the link and the border turns to a gradient on hover.
- Feature CardA card with an icon, a heading and a short description, for feature grids on landing pages.