Comparison Table

Plans side by side, feature by feature.

Source
$npx @dinachi/cli@latest add comparison-table
Only differences
Prices per seat, ex. VAT
Starter
Recommended
Team
Business
£0
£24
a month
£79
a month
Usage
Projects3UnlimitedUnlimited
Seats1Up to 20Unlimited
Storage5 GB100 GB1 TB
Builds a month1003,000Unlimited
Bandwidth100 GB1 TB1 TB
Collaboration
Comments
Preview links
Roles and permissions
Single sign-on
Audit log
Support
Help centre
Email support
Response timeNone1 day4 hours
Uptime SLA99.9%
£24a month
£79a month

Usage

Projects
Team: Unlimited
Business: Unlimited
Seats
Team: Up to 20
Business: Unlimited
Storage
Team: 100 GB
Business: 1 TB
Builds a month
Team: 3,000
Business: Unlimited
Bandwidth
Team: 1 TB
Business: 1 TB

Collaboration

Comments
Team:
Business:
Preview links
Team:
Business:
Roles and permissions
Team:
Business:
Single sign-on
Team:
Business:
Audit log
Team:
Business:

Support

Help centre
Team:
Business:
Email support
Team:
Business:
Response time
Team: 1 day
Business: 4 hours
Uptime SLA
Team:
Business: 99.9%
highlighted
note
disabled

Usage

import { ComparisonTable } from "@/components/ui/comparison-table"

const perSeat = { monthly: "a month", yearly: "a month, billed yearly" }

const plans = [
  { id: "starter", name: "Starter", price: { monthly: "£0", yearly: "£0" }, cta: { label: "Start free" } },
  { id: "team", name: "Team", price: { monthly: "£24", yearly: "£20" }, per: perSeat, highlighted: true },
  { id: "business", name: "Business", price: { monthly: "£79", yearly: "£66" }, per: perSeat },
]

const groups = [
  {
    label: "Usage",
    features: [
      { label: "Projects", values: { starter: "3", team: "Unlimited", business: "Unlimited" } },
      { label: "Single sign-on", values: { business: true } },
    ],
  },
]

export function Pricing() {
  return <ComparisonTable plans={plans} groups={groups} note="Prices per seat, ex. VAT" />
}

Examples

Only differences
Prices per seat, ex. VAT
Starter
Recommended
Team
Business
£0
£24
a month
£79
a month
Usage
Projects3UnlimitedUnlimited
Seats1Up to 20Unlimited
Storage5 GB100 GB1 TB
Builds a month1003,000Unlimited
Bandwidth100 GB1 TB1 TB
Collaboration
Comments
Preview links
Roles and permissions
Single sign-on
Audit log
Support
Help centre
Email support
Response timeNone1 day4 hours
Uptime SLA99.9%
£24a month
£79a month

Usage

Projects
Team: Unlimited
Business: Unlimited
Seats
Team: Up to 20
Business: Unlimited
Storage
Team: 100 GB
Business: 1 TB
Builds a month
Team: 3,000
Business: Unlimited
Bandwidth
Team: 1 TB
Business: 1 TB

Collaboration

Comments
Team:
Business:
Preview links
Team:
Business:
Roles and permissions
Team:
Business:
Single sign-on
Team:
Business:
Audit log
Team:
Business:

Support

Help centre
Team:
Business:
Email support
Team:
Business:
Response time
Team: 1 day
Business: 4 hours
Uptime SLA
Team:
Business: 99.9%
Three plans with the middle one highlighted. The plan row sticks as the features scroll under it.
import { ComparisonTable } from '@/components/ui/comparison-table';

const perSeat = { monthly: 'a month', yearly: 'a month, billed yearly' };

const plans = [
  { id: 'starter', name: 'Starter', price: { monthly: '£0', yearly: '£0' }, cta: { label: 'Start free' } },
  { id: 'team', name: 'Team', price: { monthly: '£24', yearly: '£20' }, per: perSeat, highlighted: true },
  { id: 'business', name: 'Business', price: { monthly: '£79', yearly: '£66' }, per: perSeat },
];

const groups = [
  {
    label: 'Usage',
    features: [
      { label: 'Projects', values: { starter: '3', team: 'Unlimited', business: 'Unlimited' } },
      { label: 'Seats', values: { starter: '1', team: 'Up to 20', business: 'Unlimited' } },
    ],
  },
  {
    label: 'Collaboration',
    features: [
      { label: 'Comments', values: { starter: true, team: true, business: true } },
      { label: 'Single sign-on', values: { business: true } },
    ],
  },
];

export function Example() {
  return <ComparisonTable plans={plans} groups={groups} note="Prices per seat, ex. VAT" maxHeight={470} />;
}

Notes

Highlight

The highlighted plan is a tinted column, the only filled button and a Recommended badge over its name, on a phone too. Set badge to word it your way, or to label any plan.

Periods

Monthly and Yearly by default. Pass billingPeriods for your own, such as rate types, and key each plan's price by their values. A plain price is the same for every period. billingPeriods={false} drops the toggle for plans with a single price.

Buttons

Each plan has a button, Choose and the plan's name unless cta.label says otherwise. cta: false leaves a plan without one, and the row of buttons goes when no plan has one.

Only differences

The switch hides every feature where all plans agree, drops a section that ends up empty, and says how many it hid. On a phone it compares the two plans on screen.

Sticky plan row

The plan row sticks with its price and button, so a choice is one click away while reading. Set --comparison-table-top to clear a sticky site header, or maxHeight to scroll inside the table.

Phone

Below 768px it compares two plans at a time, picked at the top. Each feature is a label with the two values under it, aligned to the pickers, so nothing scrolls sideways.

API

plansComparisonPlan[]
Each plan: id, name, price and per as one node or keyed by period value, cta (false for none), highlighted for the one to tint, and badge for its label.
groupsComparisonGroup[]
Sections of features. Each feature has a label and values by plan id: true, false or text. A missing value is not included.
billingPeriods
agent
{ value: string; label: string }[] | false = Monthly and Yearly
The toggle's periods, which price and per are keyed by. false, or fewer than two, drops the toggle, for plans with one price.
billingLabel
agent
string = "Billing"
Names the toggle, for people and agents.
billing
agent
string
Controlled billing period, by value.
defaultBillingstring = the first period
Starting period when uncontrolled.
onBillingChange
agent
(billing, details) => void
Runs on every change, for people and agents. details.cancel() refuses it.
onlyDifferences
agent
boolean
Controlled filter that hides features every plan shares.
defaultOnlyDifferencesboolean = false
Starting filter when uncontrolled.
onOnlyDifferencesChange
agent
(on, details) => void
Runs on every change to the filter. details.cancel() refuses it.
noteReactNode
Small text over the feature names, such as Prices per seat, ex. VAT.
defaultPhonePlans[string, string]
The two plan ids a phone compares first. Defaults to the highlighted plan and the next.
maxHeightnumber | string
Caps the height so features scroll under the plan row. Without it the plan row sticks to the page, below --comparison-table-top.
disabled
agent
boolean = false
Blocks people and agents.

Agent

Inside an AgentProvider, it appears in agent.snapshot() as toggle-group.

Reads

label

"Billing", or billingLabel.

value

The chosen period's label, such as Monthly.

items

Every period's label.

Actions

setValue("Yearly")

Switches the billing period.

An agent's change runs through onBillingChange like anyone's. isAgentChange(details) is true for it; details.cancel() refuses it. A period that is not on the toggle is refused with the periods listed. Without a toggle there is no Billing entry. "Only differences" is a switch the agent flips with toggle or setChecked, and the plan buttons are buttons or links it can press.

await agent.act({
  steps: [
    { ref: "Billing", action: "setValue", args: ["Yearly"] },
    { ref: "Only differences", action: "setChecked", args: [true] },
  ],
})

Accessibility

  • A native table, read by row: features are row headers and plans are column headers.
  • Each section is a header row that spans the plans, with scope="colgroup".
  • A tick is announced as Included and a dash as Not included, not as symbols.
  • The hidden count is a polite live region, so turning the filter on says what it did.
  • The badge is part of its plan's column header, and describes the plan's button and phone picker.
  • A cta.label without the plan's name, such as Book, is read with it: Book, Team.
  • Prices sit in a row under the plan names, so a column header reads as the plan alone.
  • On a phone the two pickers are named First plan and Second plan, and each value is prefixed with its plan's name for screen readers.