Comparison table

An us versus them table with a sticky header, a highlighted column, and a stacked phone view.

npx shadcn@latest add @silicon-ui/comparison-table
Loading…

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/comparison-table

Manually

  1. Install the dependencies.

    npm install lucide-react motion
  2. Copy these files into your project. Shared files are skipped if you already have them.

    • components/silicon-ui/blocks/comparison-table/comparison-table.tsx
    • components/silicon-ui/blocks/comparison-table/comparison-table-data.ts
    • components/silicon-ui/blocks/comparison-table/comparison-table.module.css
  3. Install the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

Source codetsx
import { ComparisonTable } from "@/components/silicon-ui/blocks/comparison-table/comparison-table";

API reference

ComparisonTable

PropTypeDefault
titlestring"How Relay compares"
descriptionstring"Everything a growing team needs, without the enterprise price or the spreadsheet sprawl."
columnsComparisonColumn[]comparisonColumns
sectionsComparisonSection[]comparisonSections
differencesOnly

Hide rows where every visible column has the same value (controlled).

boolean—
defaultDifferencesOnlybooleanfalse
onDifferencesOnlyChange(value: boolean) => void—
compareWith

Competitor shown beside yours in the stacked phone layout (controlled).

string—
onCompareWithChange(id: string) => void—
cta

Call to action in your column.

{ label: string; href?: string; onClick?: () => void; doneLabel?: string }—
stickyTop

Offset for the sticky header, such as the height of a fixed site header. Defaults to 0.

number0
maxHeight

Caps the table height and scrolls it inside the block, with the header sticking to its top.

number | string—
stackBelow

Width below which the table stacks into a two column comparison. Defaults to 640.

number640
classNamestring—

Dependencies

npm
lucide-reactmotion
Registry
silicon-motion-tokens