Comparison table
Feature-by-plan table with row headers that scrolls inside its own box on phones.
Preview
Rows fade in top to bottom as the table scrolls into view, so it reads feature by feature. With reduced motion turned on, it renders the plain layout.
Compare plans
| Feature | Hobby | Pro | Team |
|---|---|---|---|
| Projects | 1 | 10 | Unlimited |
| Feature reports | Not included | Included | Included |
| Single sign-on | Not included | Not included | Included |
| Support | Community | Priority |
Compare plans
| Feature | Hobby | Pro | Team |
|---|---|---|---|
| Projects | 1 | 10 | Unlimited |
| Feature reports | Not included | Included | Included |
| Single sign-on | Not included | Not included | Included |
| Support | Community | Priority |
Installation
Run this in a project that already uses shadcn/ui. It adds the component and anything it needs; the motion version also adds the plain one and the motion package.
Usage
import { ComparisonTable } from "@/components/custom/comparison-table";
<ComparisonTable
caption="Plans compared feature by feature"
plans={["Free", "Pro"]}
rows={[
{ feature: "Projects", values: ["1", "Unlimited"] },
{ feature: "Reports", values: [false, true] },
]}
/>import { ComparisonTableMotion } from "@/components/custom/comparison-table/comparison-table-motion";
<ComparisonTableMotion caption="Plans compared" plans={plans} rows={rows} />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| caption* (required) | string | – | Names the table for screen readers. |
| plans* (required) | string[] | – | Column headers. |
| rows* (required) | { feature: string; values: (boolean | string)[] }[] | – | One value per plan. |
| title | string | – | Optional heading (h2). |
| featureLabel | string | "Feature" | Header over the feature column. |
| ...props | React.ComponentProps<"section"> | – | Any other section attribute (id, aria-*, data-*, ref) goes to the root element. |
| Prop | Type | Default | Description |
|---|---|---|---|
| caption* (required) | string | – | Names the table for screen readers. |
| plans* (required) | string[] | – | Column headers. |
| rows* (required) | { feature: string; values: (boolean | string)[] }[] | – | One value per plan. |
| title | string | – | Optional heading (h2). |
| featureLabel | string | "Feature" | Header over the feature column. |
| ...props | React.ComponentProps<"section"> | – | Any other section attribute (id, aria-*, data-*, ref) goes to the root element. |
Accessibility
- Real table markup with a caption, column headers and row headers.
- Checks and dashes read as “Included” and “Not included”.
- On narrow screens the table scrolls inside a focusable region.
- The motion version follows the visitor's reduced-motion setting and never hides content before it animates.