# Comparison: two-plan matrix

> A compact, responsive table comparing the features of two plans.

- Kind: block · Category: Comparison · Interactivity: none
- Install: `npx shadcn@latest add @haze/comparison-plan-matrix`
- File: `src/components/haze/blocks/comparison-plan-matrix.astro`
- npm dependencies: none
- Registry dependencies: @haze/utils
- Docs page: https://hazeui.com/blocks/comparison-plan-matrix

## Use when
- A buyer needs to compare two plans feature by feature
- Plan values need clear text labels rather than icons alone

## Avoid when
- You need to present plan prices and calls to action; use pricing-three-tier

## Alternatives
- [pricing-three-tier](https://hazeui.com/blocks/pricing-three-tier.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| id | `string` | "comparison-plan-matrix" | no | ID prefix for this labelled section. |
| eyebrow | `string` | "Compare plans" | no | Small label above the heading. |
| title | `string` | demo heading | no | Section heading and table caption. |
| description | `string` | demo copy | no | Introduction; replace the example-plan notice with your own copy. |
| headingLevel | `1 \| 2 \| 3` | 2 | no | Level of the section heading. |
| plans | `[string, string]` | ["Starter", "Team"] | no | Names for the first and second comparison columns. |
| features | `{ name: string; first: string; second: string }[]` | 5 demo features | no | Feature names and their corresponding text values. |
| class | `string` |  | no | Additional classes on the section. |

## Accessibility
- The native table identifies column and row headers and has a caption.
- Plan availability is written in text, so it is not conveyed by color or icons alone.

## Agent prompts

### Install and use

Install the Haze UI block "Comparison: two-plan matrix" with `npx shadcn@latest add @haze/comparison-plan-matrix`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import ComparisonPlanMatrix from "@/components/haze/blocks/comparison-plan-matrix.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/blocks/comparison-plan-matrix.md

### Customize with real content

Adapt the Haze comparison-plan-matrix block for our product. Replace the demo values of these props with our real content: id, eyebrow, title, description, headingLevel, plans, features, class. Keep the layout, the heading level rules and these accessibility details: The native table identifies column and row headers and has a caption. Plan availability is written in text, so it is not conveyed by color or icons alone. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using comparison-plan-matrix, check it fits: use it when a buyer needs to compare two plans feature by feature; plan values need clear text labels rather than icons alone. Avoid it when you need to present plan prices and calls to action; use pricing-three-tier. Alternatives: @haze/pricing-three-tier.

## Example requests that should lead here
- Compare two subscription plans in a compact accessible feature table

## Source

```astro
---
import { cn } from "../../../lib/haze/utils";

interface Props {
  id?: string;
  eyebrow?: string;
  title?: string;
  description?: string;
  headingLevel?: 1 | 2 | 3;
  plans?: [string, string];
  features?: { name: string; first: string; second: string }[];
  class?: string;
}

const {
  id = "comparison-plan-matrix",
  eyebrow = "Compare plans",
  title = "The details, side by side",
  description = "Find the right starting point for your team. The values below are examples.",
  headingLevel = 2,
  plans = ["Starter", "Team"],
  features = [
    { name: "Members", first: "Up to 3", second: "Unlimited" },
    { name: "Projects", first: "Up to 5", second: "Unlimited" },
    { name: "Activity history", first: "30 days", second: "1 year" },
    { name: "Guest access", first: "Not included", second: "Included" },
    { name: "Priority support", first: "Not included", second: "Included" },
  ],
  class: className,
} = Astro.props;
const Heading = ({ 1: "h1", 2: "h2", 3: "h3" } as const)[headingLevel];
---

<section aria-labelledby={`${id}-title`} class={cn("bg-background px-6 py-20 sm:py-24", className)}>
  <div class="mx-auto max-w-5xl">
    <div class="max-w-2xl">
      <p class="text-[0.6875rem]/4 font-medium tracking-wider text-muted-foreground uppercase">{eyebrow}</p>
      <Heading id={`${id}-title`} class="mt-3 text-3xl/9 font-semibold tracking-tight text-balance text-foreground sm:text-4xl/11">{title}</Heading>
      <p class="mt-4 text-base/7 text-pretty text-muted-foreground">{description}</p>
    </div>
    <div class="mt-10 overflow-hidden rounded-xl border border-border bg-card">
      <table class="w-full table-fixed border-collapse text-left text-[0.8125rem]/5 sm:text-sm/6">
        <caption class="sr-only">{title}</caption>
        <thead>
          <tr class="border-b border-border bg-foreground/5">
            <th scope="col" class="w-2/5 px-3 py-4 font-medium text-muted-foreground sm:px-6">Feature</th>
            {plans.map((plan) => <th scope="col" class="px-2 py-4 font-semibold text-foreground sm:px-6">{plan}</th>)}
          </tr>
        </thead>
        <tbody class="divide-y divide-border">
          {features.map((feature) => (
            <tr>
              <th scope="row" class="break-words px-3 py-4 font-medium text-foreground sm:px-6">{feature.name}</th>
              <td class="break-words px-2 py-4 text-muted-foreground sm:px-6">{feature.first}</td>
              <td class="break-words px-2 py-4 text-foreground sm:px-6">{feature.second}</td>
            </tr>
          ))}
        </tbody>
      </table>
    </div>
  </div>
</section>
```
