Compare

Plans or products compared feature by feature in a table: a tick, a cross or a word per cell, the highlighted column tinted, and a header that stays in view as the rows scroll, here a brand beside two others, centred.

Your headline goes here

A short line about it goes here.

  • Brand

    • Feature 1included
    • Feature 2included
    • Feature 3included
    • Feature 4included
    • Feature 5included
    • Feature 6included
    • Feature 7included
  • Item 1

    • Feature 1Label
    • Feature 2not included
    • Feature 3Label
    • Feature 4not included
    • Feature 5not included
    • Feature 6Label
    • Feature 7Label
  • Item 2

    • Feature 1not included
    • Feature 2not included
    • Feature 3not included
    • Feature 4Label
    • Feature 5not included
    • Feature 6Label
    • Feature 7not included
import {
  Compare,
  type CompareColumn,
  type CompareRow,
} from "@produkto/ui/Compare";

const columns: CompareColumn[] = [
  { name: "Brand", highlighted: true },
  { name: "Item 1" },
  { name: "Item 2" },
];

const rows: CompareRow[] = [
  {
    feature: "Feature 1",
    values: [true, "Label", false],
  },
  { feature: "Feature 2", values: [true, false, false] },
  {
    feature: "Feature 3",
    values: [true, "Label", false],
  },
  {
    feature: "Feature 4",
    values: [true, false, "Label"],
  },
  {
    feature: "Feature 5",
    values: [true, false, false],
  },
  {
    feature: "Feature 6",
    values: [true, "Label", "Label"],
  },
  {
    feature: "Feature 7",
    values: [true, "Label", false],
  },
];

const Example = () => (
  <Compare
    align="center"
    columns={columns}
    description="A short line about it goes here."
    featuresLabel="Features"
    rows={rows}
    title="Your headline goes here"
  />
);

export default Example;

Usage

import {
  Compare,
  type CompareColumn,
  type CompareRow,
} from "@produkto/ui/Compare";
const columns: CompareColumn[] = [
  { name: "Plan 1", cta: { label: "Button", link: "#" } },
  { name: "Plan 2", highlighted: true, cta: { label: "Button", link: "#" } },
];

const rows: CompareRow[] = [
  { feature: "Feature 1", values: ["10", "Unlimited"] },
  { feature: "Feature 2", values: [false, true] },
];

<Compare
  columns={columns}
  featuresLabel="Features"
  rows={rows}
  title="Your headline goes here"
/>

Examples

Us and the other way

Two columns set one product beside another, the highlighted one tinted, under a centred heading.

Your headline goes here

A short line about it goes here.

  • Brand

    • Feature 1included
    • Feature 2included
    • Feature 3included
    • Feature 4Unlimited
    • Feature 5$10
  • Others

    • Feature 1included
    • Feature 2not included
    • Feature 3not included
    • Feature 410
    • Feature 5$20
import {
  Compare,
  type CompareColumn,
  type CompareRow,
} from "@produkto/ui/Compare";

const columns: CompareColumn[] = [
  { name: "Brand", highlighted: true },
  { name: "Others" },
];

const rows: CompareRow[] = [
  { feature: "Feature 1", values: [true, true] },
  { feature: "Feature 2", values: [true, false] },
  { feature: "Feature 3", values: [true, false] },
  { feature: "Feature 4", values: ["Unlimited", "10"] },
  { feature: "Feature 5", values: ["$10", "$20"] },
];

const Example = () => (
  <Compare
    align="center"
    columns={columns}
    description="A short line about it goes here."
    rows={rows}
    title="Your headline goes here"
    width="narrow"
  />
);

export default Example;

Two options

layout="options" sets each option on a card side by side at every width, its price under its name, its points and its button.

Compare

Your headline goes here

A short line about the two options goes here.

  • Option 1

    $120

    Button
    • Feature 1included
    • Feature 2included
    • Feature 3not included
    • Feature 4Detail 1
  • Option 2

    Badge

    $180

    Button
    • Feature 1included
    • Feature 2included
    • Feature 3included
    • Feature 4Detail 2
import { Compare, type CompareColumn } from "@produkto/ui/Compare";

const columns: CompareColumn[] = [
  {
    name: "Option 1",
    price: "$120",
    cta: { label: "Button", link: "#" },
  },
  {
    name: "Option 2",
    price: "$180",
    badge: "Badge",
    highlighted: true,
    cta: { label: "Button", link: "#" },
  },
];

const Example = () => (
  <Compare
    columns={columns}
    description="A short line about the two options goes here."
    eyebrow="Compare"
    layout="options"
    rows={[
      { feature: "Feature 1", values: [true, true] },
      { feature: "Feature 2", values: [true, true] },
      { feature: "Feature 3", values: [false, true] },
      { feature: "Feature 4", values: ["Detail 1", "Detail 2"] },
    ]}
    title="Your headline goes here"
  />
);

export default Example;

Groups

groups sets the rows under titled bands, each its own table body, so a long list reads in sections.

Compare

Your headline goes here

A short line about it goes here.

  • Plan 1

    Button

    Group 1

    • Feature 11
    • Feature 2$5
    • Feature 3included

    Group 2

    • Feature 4not included
    • Feature 5not included
    • Feature 6not included

    Group 3

    • Feature 7Item 1
    • Feature 8not included
  • Plan 2

    Badge
    Button

    Group 1

    • Feature 110
    • Feature 2$10
    • Feature 3included

    Group 2

    • Feature 4included
    • Feature 5included
    • Feature 6not included

    Group 3

    • Feature 7Item 2
    • Feature 8not included
  • Plan 3

    Button

    Group 1

    • Feature 1Unlimited
    • Feature 2$20
    • Feature 3included

    Group 2

    • Feature 4included
    • Feature 5included
    • Feature 6included

    Group 3

    • Feature 7Item 3
    • Feature 8included
import {
  Compare,
  type CompareColumn,
  type CompareGroup,
} from "@produkto/ui/Compare";

const columns: CompareColumn[] = [
  { name: "Plan 1", cta: { label: "Button", link: "#" } },
  {
    name: "Plan 2",
    highlighted: true,
    badge: "Badge",
    cta: { label: "Button", link: "#" },
  },
  { name: "Plan 3", cta: { label: "Button", link: "#" } },
];

const groups: CompareGroup[] = [
  {
    title: "Group 1",
    rows: [
      { feature: "Feature 1", values: ["1", "10", "Unlimited"] },
      { feature: "Feature 2", values: ["$5", "$10", "$20"] },
      { feature: "Feature 3", values: [true, true, true] },
    ],
  },
  {
    title: "Group 2",
    rows: [
      { feature: "Feature 4", values: [false, true, true] },
      { feature: "Feature 5", values: [false, true, true] },
      { feature: "Feature 6", values: [false, false, true] },
    ],
  },
  {
    title: "Group 3",
    rows: [
      {
        feature: "Feature 7",
        values: ["Item 1", "Item 2", "Item 3"],
      },
      { feature: "Feature 8", values: [false, false, true] },
    ],
  },
];

const Example = () => (
  <Compare
    columns={columns}
    description="A short line about it goes here."
    eyebrow="Compare"
    featuresLabel="Features"
    groups={groups}
    title="Your headline goes here"
  />
);

export default Example;

Scroll

layout="scroll" keeps the table on a phone, scrolling it sideways while the feature column stays pinned, where the default turns each column into a card.

Compare

Your headline goes here

A short line about it goes here.

Your headline goes here
Features
Plan 1Button
Plan 2Button
Plan 3Button
Plan 4Button
Feature 1110100Unlimited
Feature 2$5$10$20$40
Feature 3includedincludedincludedincluded
Feature 4not includedincludedincludedincluded
Feature 5not includednot includedincludedincluded
Feature 6not includednot includednot includedincluded
import {
  Compare,
  type CompareColumn,
  type CompareRow,
} from "@produkto/ui/Compare";

const columns: CompareColumn[] = [
  { name: "Plan 1", cta: { label: "Button", link: "#" } },
  {
    name: "Plan 2",
    highlighted: true,
    cta: { label: "Button", link: "#" },
  },
  { name: "Plan 3", cta: { label: "Button", link: "#" } },
  { name: "Plan 4", cta: { label: "Button", link: "#" } },
];

const rows: CompareRow[] = [
  { feature: "Feature 1", values: ["1", "10", "100", "Unlimited"] },
  { feature: "Feature 2", values: ["$5", "$10", "$20", "$40"] },
  { feature: "Feature 3", values: [true, true, true, true] },
  { feature: "Feature 4", values: [false, true, true, true] },
  { feature: "Feature 5", values: [false, false, true, true] },
  { feature: "Feature 6", values: [false, false, false, true] },
];

const Example = () => (
  <Compare
    columns={columns}
    description="A short line about it goes here."
    eyebrow="Compare"
    featuresLabel="Features"
    layout="scroll"
    rows={rows}
    title="Your headline goes here"
  />
);

export default Example;

Muted

muted sets the band on the muted ground, the table standing out on its card.

Compare

Your headline goes here

A short line about it goes here.

  • Plan 1

    Button
    • Feature 11
    • Feature 2included
    • Feature 3not included
    • Feature 4not included
  • Plan 2

    Badge
    Button
    • Feature 110
    • Feature 2included
    • Feature 3included
    • Feature 4not included
  • Plan 3

    Button
    • Feature 1Unlimited
    • Feature 2included
    • Feature 3included
    • Feature 4included
import {
  Compare,
  type CompareColumn,
  type CompareRow,
} from "@produkto/ui/Compare";

const columns: CompareColumn[] = [
  { name: "Plan 1", cta: { label: "Button", link: "#" } },
  {
    name: "Plan 2",
    highlighted: true,
    badge: "Badge",
    cta: { label: "Button", link: "#" },
  },
  { name: "Plan 3", cta: { label: "Button", link: "#" } },
];

const rows: CompareRow[] = [
  { feature: "Feature 1", values: ["1", "10", "Unlimited"] },
  { feature: "Feature 2", values: [true, true, true] },
  { feature: "Feature 3", values: [false, true, true] },
  { feature: "Feature 4", values: [false, false, true] },
];

const Example = () => (
  <Compare
    columns={columns}
    description="A short line about it goes here."
    eyebrow="Compare"
    rows={rows}
    muted
    title="Your headline goes here"
  />
);

export default Example;

API Reference

Compare

CompareProps · blocks/Compare/Compare.types.ts
PropTypeDefault
columnsCompareColumn[]-
rowsCompareRow[]-
groupsCompareGroup[]-
layoutCompareLayout"cards" | "scroll" | "options""cards"
featuresLabelstring-
captionstring-
idstring-
eyebrowstring-
titleReactNode-
descriptionReactNode-
alignSectionAlign"start" | "center" | "end""start"
widthSectionWidth"narrow" | "base" | "wide""base"
mutedbooleanfalse
classNamestring-

CompareTable

CompareTableProps
PropTypeDefault
columnsCompareColumn[]-
rowsCompareRow[]-
groupsCompareGroup[]-
layoutCompareLayout"cards" | "scroll" | "options""cards"
featuresLabelstring-
captionstring-
classNamestring-

CompareColumn

used by columns
PropTypeDefault
namerequiredstring-
highlightedboolean-
badgestring-
pricestring-
ctaBlockAction-

CompareRow

used by rows
PropTypeDefault
featurerequiredstring-
detailstring-
valuesrequiredCompareValue[]-

CompareGroup

used by groups
PropTypeDefault
titlerequiredstring-
rowsrequiredCompareRow[]-

BlockAction

used by its parts
PropTypeDefault
appearanceButtonAppearance"solid" | "soft" | "outline" | "transparent"-
toneButtonTone"neutral" | "accent" | "destructive" | "success" | "warning" | "info"-
iconReactNode-
iconOnlyboolean-
borderRadiusBlockActionBorderRadius"none" | "xs" | "sm" | "base" | "lg" | "xl" | "full"-
labelrequiredstring-
linkrequiredstring-