Components
Comparison table
NativeCompare plans using feature rows, written inclusion states and a recommended column.
| Feature | Personal $0 / month | Studio $18 / seat / monthRecommended |
|---|---|---|
| Active projects | 3 projects | Unlimited |
| File storage | 2 GB | 100 GB |
| Guest reviewers | Included | Included |
| Approval workflows | Not included | Included |
| Support | Community | Priority email |
Installation
npx nook-ui@latest add comparison-tablePrompt
Paste this into your AI coding assistant. It adds this exact component, the same way the CLI does, and tells the assistant how to use it.
Short. For assistants that can run commands in your project.
Add the Nook "Comparison table" component to this project, exactly as Nook ships it.
Compare plans using feature rows, written inclusion states and a recommended column.
Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add comparison-table`. It writes `components/ui/comparison-table.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/comparison-table.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:
```tsx
import { ComparisonTable } from "@/components/ui/comparison-table";
export default function Example() {
return (
<ComparisonTable
caption="Choose the workspace plan that fits your team."
highlightedPlan="studio"
plans={[
{ id: "personal", name: "Personal", description: "$0 / month" },
{ id: "studio", name: "Studio", description: "$18 / seat / month" },
]}
features={[
{
name: "Active projects",
values: { personal: "3 projects", studio: "Unlimited" },
},
{
name: "File storage",
values: { personal: "2 GB", studio: "100 GB" },
},
{ name: "Guest reviewers", values: { personal: true, studio: true } },
{
name: "Approval workflows",
values: { personal: false, studio: true },
},
{
name: "Support",
values: { personal: "Community", studio: "Priority email" },
},
]}
/>
);
}
```
API
- `ComparisonTable`: Compare plans using feature rows, written inclusion states and a recommended column.
- `caption` (`string`): Accessible name and visible caption.
- `plans / features` (`ComparisonPlan[] / ComparisonFeature[]`): Columns and feature values.
- `highlightedPlan` (`string`): ID of the recommended plan.
Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: Native table headers connect plans and features; the table scrolls with keyboard focus.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
import { ComparisonTable } from "@/components/ui/comparison-table";
export default function Example() {
return (
<ComparisonTable
caption="Choose the workspace plan that fits your team."
highlightedPlan="studio"
plans={[
{ id: "personal", name: "Personal", description: "$0 / month" },
{ id: "studio", name: "Studio", description: "$18 / seat / month" },
]}
features={[
{
name: "Active projects",
values: { personal: "3 projects", studio: "Unlimited" },
},
{
name: "File storage",
values: { personal: "2 GB", studio: "100 GB" },
},
{ name: "Guest reviewers", values: { personal: true, studio: true } },
{
name: "Approval workflows",
values: { personal: false, studio: true },
},
{
name: "Support",
values: { personal: "Community", studio: "Priority email" },
},
]}
/>
);
}Props
ComparisonTable
Compare plans using feature rows, written inclusion states and a recommended column.
| Prop | Type | Default | Description |
|---|---|---|---|
| caption | string | – | Accessible name and visible caption. |
| plans / features | ComparisonPlan[] / ComparisonFeature[] | – | Columns and feature values. |
| highlightedPlan | string | – | ID of the recommended plan. |
Accessibility
Native table headers connect plans and features; the table scrolls with keyboard focus.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.