# Plan comparison

> Compare meaningful differences between plans and billing periods.

A shadcn/ui block from the [@uiarc](https://uiarc.dev) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/uiarc/plan-comparison).

- Page, with a live preview: https://shadcn.exchange/r/uiarc/plan-comparison
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/uiarc/plan-comparison-light-e9b856f2441c040b.png
- Registry item: https://uiarc.dev/r/plan-comparison.json
- Categories: blocks
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://uiarc.dev/r/plan-comparison.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `lucide-react`, `motion`
- Registry items: `https://uiarc.dev/r/arc-motion-tokens.json`, `https://uiarc.dev/r/button.json`, `https://uiarc.dev/r/segmented-control.json`, `https://uiarc.dev/r/switch.json`

## Notes from the registry

Use this when people need to weigh plans side by side. Replace the sample features and prices with your current offering.

## Files

### `registry/blocks/plan-comparison/plan-comparison.tsx`

```tsx
"use client";

import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
import { animate, AnimatePresence, motion, useReducedMotion } from "motion/react";
import { Check } from "lucide-react";
import { Button } from "../../button/button";
import SegmentedControl from "../../segmented-control/segmented-control";
import { Switch } from "../../switch/switch";
import { motionTokens } from "../../lib/motion-tokens";
import styles from "./plan-comparison.module.css";

type Plan = "team" | "studio";
type Billing = "monthly" | "yearly";
type Feature = { label: string; team: string; studio: string; shared?: boolean };

const features: Feature[] = [
  { label: "Active projects", team: "Unlimited", studio: "Unlimited", shared: true },
  { label: "Shared workspaces", team: "1 workspace", studio: "Unlimited" },
  { label: "Guest reviewers", team: "5 per project", studio: "Unlimited" },
  { label: "Version history", team: "30 days", studio: "Unlimited" },
  { label: "Approval flows", team: "Not included", studio: "Included" },
  { label: "Custom roles", team: "Not included", studio: "Included" },
  { label: "Source exports", team: "Included", studio: "Included", shared: true },
  { label: "Support", team: "Email", studio: "Priority email" },
];

const pricing: Record<Plan, Record<Billing, number>> = {
  team: { monthly: 13, yearly: 10 },
  studio: { monthly: 27, yearly: 22 },
};

function Value({ text }: { text: string }) {
  if (text === "Included") return <span className={styles.included}><Check size={16} strokeWidth={1.75} aria-hidden="true" />Included</span>;
  return <span className={text === "Not included" ? styles.unavailable : undefined}>{text}</span>;
}

function AnimatedNumber({ value }: { value: number }) {
  const reduce = useReducedMotion();
  const [displayValue, setDisplayValue] = useState(value);
  const previousValue = useRef(value);

  useEffect(() => {
    if (reduce) {
      previousValue.current = value;
      return;
    }

    const controls = animate(previousValue.current, value, {
      duration: motionTokens.duration.standard,
      ease: [...motionTokens.ease.enter],
      onUpdate: (latest) => setDisplayValue(Math.round(latest)),
    });

    previousValue.current = value;
    return () => controls.stop();
  }, [reduce, value]);

  return <>{reduce ? value : displayValue}</>;
}

export function PlanComparison() {
  const id = useId();
  const reduce = useReducedMotion();
  const [billing, setBilling] = useState<Billing>("monthly");
  const [differencesOnly, setDifferencesOnly] = useState(false);
  const [selected, setSelected] = useState<Plan | null>(null);
  const rootRef = useRef<HTMLElement>(null);
  const [size, setSize] = useState<"lg" | "md" | "sm" | "xs">("lg");
  useLayoutEffect(() => {
    const node = rootRef.current;
    if (!node) return;
    const measure = (width: number) => setSize(width <= 340 ? "xs" : width <= 540 ? "sm" : width <= 720 ? "md" : "lg");
    measure(node.getBoundingClientRect().width);
    const observer = new ResizeObserver(([entry]) => { if (entry) measure(entry.contentRect.width); });
    observer.observe(node);
    return () => observer.disconnect();
  }, []);
  const visibleFeatures = differencesOnly ? features.filter((feature) => !feature.shared) : features;

  return (
    <section ref={rootRef} className={styles.comparison} data-size={size} aria-labelledby={`${id}-title`}>
      <div className={styles.intro}>
        <div><h2 id={`${id}-title`}>Room for the way you work</h2><p>Only the details that change between plans. Switch billing to see what you would pay.</p></div>
        <div className={styles.billing}><SegmentedControl label="Billing period" value={billing} onValueChange={(value) => setBilling(value as Billing)} options={[{ value: "monthly", label: "Monthly" }, { value: "yearly", label: "Yearly" }]} /><small>{billing === "yearly" ? "Billed yearly, save up to 23%" : "Billed month to month"}</small></div>
      </div>

      <div className={styles.filter}><div><h3>Compare plans</h3><span className={styles.featureCount}><AnimatedNumber value={visibleFeatures.length} /> of {features.length} features</span></div><Switch checked={differencesOnly} onCheckedChange={setDifferencesOnly} label="Show differences only" /></div>

      <div className={styles.matrix} role="table" aria-label="Team and Studio plan comparison">
        <div className={styles.planHeader} role="row">
          <div className={styles.featureHeader} role="columnheader">What changes</div>
          {(["team", "studio"] as const).map((plan) => (
            <div key={plan} className={`${styles.planCell} ${selected === plan ? styles.planSelected : ""}`} role="columnheader" aria-label={`${plan === "team" ? "Team" : "Studio"} plan`}>
              <div className={styles.planTop}><h3>{plan === "team" ? "Team" : "Studio"}</h3><span>{plan === "team" ? "For smaller teams" : "For work across teams"}</span></div>
              <div className={styles.price}><span className={styles.priceValue} aria-live="polite" aria-atomic="true">$<AnimatedNumber value={pricing[plan][billing]} /></span><span className={styles.pricePeriod}>per seat / month</span></div>
              <Button type="button" variant={selected === plan ? "primary" : "secondary"} className={styles.selectButton} aria-pressed={selected === plan} onClick={() => setSelected(current => current === plan ? null : plan)}>{selected === plan ? "Selected" : `Select ${plan === "team" ? "Team" : "Studio"}`}</Button>
              {selected === plan && <motion.span className={styles.selectedRail} layoutId={`${id}-selected-rail`} transition={reduce ? { duration: 0 } : motionTokens.spring.responsive} aria-hidden="true" />}
            </div>
          ))}
        </div>

        <div className={styles.rows} role="rowgroup">
          <AnimatePresence initial={false}>
            {visibleFeatures.map((feature) => (
              <motion.div key={feature.label} className={styles.featureRow} role="row" initial={reduce ? false : { height: 0, opacity: 0 }} animate={{ height: "auto", opacity: 1 }} exit={reduce ? undefined : { height: 0, opacity: 0, transition: { height: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.fast } } }} transition={reduce ? { duration: 0 } : { height: motionTokens.spring.smooth, opacity: { duration: motionTokens.duration.standard, ease: [...motionTokens.ease.enter], delay: .04 } }}>
                <div className={styles.featureName} role="rowheader">{feature.label}</div>
                <div className={`${styles.featureValue} ${selected === "team" ? styles.valueSelected : ""}`} role="cell"><span className={styles.mobilePlan}>Team</span><Value text={feature.team} /></div>
                <div className={`${styles.featureValue} ${selected === "studio" ? styles.valueSelected : ""}`} role="cell"><span className={styles.mobilePlan}>Studio</span><Value text={feature.studio} /></div>
              </motion.div>
            ))}
          </AnimatePresence>
        </div>
      </div>

      <div className={styles.footer}><span>Prices in USD per seat. Yearly plans are billed annually.</span><p className={styles.srOnly} role="status" aria-live="polite">{selected ? `${selected === "team" ? "Team" : "Studio"} selected` : ""}</p></div>
    </section>
  );
}

export default PlanComparison;
```

### `registry/blocks/plan-comparison/plan-comparison.module.css`

```css
.comparison { box-sizing: border-box; width: min(100%, 1060px); min-width: 0; margin-inline: auto; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-panel); background: var(--surface); color: var(--foreground); font-family: var(--font-body); font-size: var(--text-sm); letter-spacing: var(--tracking-body); line-height: var(--leading-body); }
.comparison *, .comparison *::before, .comparison *::after { box-sizing: border-box; }

/* Intro */
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 32px; padding: 32px 32px 24px; }
.intro > div:first-child { min-width: 0; max-width: 560px; }
.intro h2 { margin: 0; font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 400; letter-spacing: var(--tracking-display); line-height: var(--leading-display); text-wrap: balance; }
.intro p { max-width: 46ch; margin: 8px 0 0; color: var(--text-secondary); text-wrap: pretty; }
.billing { display: grid; flex: none; justify-items: end; gap: 6px; }
.billing small { min-height: 16px; color: var(--text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }

/* Filter bar */
.filter { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 8px 16px; border-top: 1px solid var(--border); padding: 8px 32px; }
.filter > div:first-child { display: flex; align-items: baseline; gap: 10px; }
.filter h3 { margin: 0; font-size: var(--text-sm); font-weight: 500; }
.featureCount { min-width: 11ch; color: var(--text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.filter > button { flex: none; }

/* Matrix */
.matrix { border-top: 1px solid var(--border); }
.planHeader, .featureRow { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); }
/* Plan cells share three row tracks (name, price, button), so a description that wraps in one column keeps prices and buttons level. */
.planHeader { grid-template-rows: auto auto auto; }
.featureHeader { grid-row: 1 / span 3; display: flex; align-items: end; padding: 0 16px 20px 32px; color: var(--text-muted); font-size: var(--text-xs); }
.planCell { position: relative; display: grid; grid-row: span 3; grid-template-rows: subgrid; min-width: 0; align-content: start; border-left: 1px solid var(--border); padding: 20px; transition: background-color var(--duration-standard) var(--ease-standard); }
.planCell.planSelected, .featureValue.valueSelected { background: var(--surface-muted); }
.planTop h3 { margin: 0; font-size: var(--text-base); font-weight: 500; letter-spacing: -.01em; }
.planTop > span { display: block; margin-top: 2px; color: var(--text-muted); font-size: var(--text-xs); }
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin: 16px 0 14px; }
.priceValue { display: inline-flex; min-width: 3ch; font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 400; letter-spacing: var(--tracking-display); line-height: 1; font-variant-numeric: tabular-nums; }
.pricePeriod { color: var(--text-muted); font-size: var(--text-xs); white-space: nowrap; }
.selectButton { width: 100%; }
.selectedRail { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--accent); }
.rows { border-top: 1px solid var(--border); }
.featureRow { overflow: hidden; border-bottom: 1px solid var(--border-subtle); }
.featureRow:last-child { border-bottom: 0; }
.featureName, .featureValue { display: flex; min-width: 0; min-height: 44px; align-items: center; padding: 10px 20px; }
.featureName { padding-left: 32px; color: var(--foreground); }
.featureValue { border-left: 1px solid var(--border); color: var(--text-secondary); transition: background-color var(--duration-standard) var(--ease-standard), color var(--duration-standard) var(--ease-standard); }
.featureValue.valueSelected { color: var(--foreground); }
.included { display: inline-flex; align-items: center; gap: 6px; color: var(--foreground); }
.included svg { color: var(--success); }
.unavailable { color: var(--text-muted); }
.mobilePlan { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.footer { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 8px 24px; border-top: 1px solid var(--border); padding: 12px 32px; color: var(--text-muted); font-size: var(--text-xs); }
.footer p { min-height: 1.4em; margin: 0; color: var(--text-secondary); text-align: right; }

@media (hover: hover) and (pointer: fine) {
  .featureRow:hover .featureName { color: var(--foreground); }
}

/* Layout follows the block width (data-size, measured in the component), not the viewport. */
/* Medium: keep three columns, tighten the gutters. */
.comparison:is([data-size="md"], [data-size="sm"], [data-size="xs"]) .intro { flex-direction: column; align-items: flex-start; padding: 24px 20px 20px; }
.comparison:is([data-size="md"], [data-size="sm"], [data-size="xs"]) .billing { justify-items: start; }
.comparison:is([data-size="md"], [data-size="sm"], [data-size="xs"]) .filter { padding-inline: 20px; }
.comparison:is([data-size="md"], [data-size="sm"], [data-size="xs"]) .featureHeader, .comparison:is([data-size="md"], [data-size="sm"], [data-size="xs"]) .featureName { padding-left: 20px; }
.comparison:is([data-size="md"], [data-size="sm"], [data-size="xs"]) .planCell { padding: 16px 14px; }
.comparison:is([data-size="md"], [data-size="sm"], [data-size="xs"]) .featureValue { padding-inline: 14px; }
.comparison:is([data-size="md"], [data-size="sm"], [data-size="xs"]) .footer { flex-direction: column; align-items: flex-start; padding-inline: 20px; }
.comparison:is([data-size="md"], [data-size="sm"], [data-size="xs"]) .footer p { text-align: left; }

/* Narrow: the feature name sits above its two values, which stay aligned under the plan columns. */
.comparison:is([data-size="sm"], [data-size="xs"]) .intro h2 { font-size: var(--text-2xl); }
.comparison:is([data-size="sm"], [data-size="xs"]) .filter { flex-wrap: wrap; }
.comparison:is([data-size="sm"], [data-size="xs"]) .planHeader, .comparison:is([data-size="sm"], [data-size="xs"]) .featureRow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.comparison:is([data-size="sm"], [data-size="xs"]) .featureHeader { display: none; }
.comparison:is([data-size="sm"], [data-size="xs"]) .planCell { border-left: 0; }
.comparison:is([data-size="sm"], [data-size="xs"]) .planCell + .planCell { border-left: 1px solid var(--border); }
.comparison:is([data-size="sm"], [data-size="xs"]) .priceValue { font-size: var(--text-2xl); }
.comparison:is([data-size="sm"], [data-size="xs"]) .featureName { grid-column: 1 / -1; min-height: 0; padding: 10px 20px 0; color: var(--text-secondary); font-size: var(--text-xs); }
.comparison:is([data-size="sm"], [data-size="xs"]) .featureValue { min-height: 0; border-left: 0; padding: 4px 14px 10px; }
.comparison:is([data-size="sm"], [data-size="xs"]) .featureValue:nth-child(2) { padding-left: 20px; }
.comparison:is([data-size="sm"], [data-size="xs"]) .featureValue + .featureValue { border-left: 1px solid var(--border-subtle); }
.comparison:is([data-size="sm"], [data-size="xs"]) .planCell:nth-child(2) { padding-left: 20px; }
.comparison[data-size="xs"] .planCell { padding-inline: 12px; }
.comparison[data-size="xs"] .planCell:nth-child(2) { padding-left: 16px; }
.comparison[data-size="xs"] .featureValue { padding-inline: 12px; }
.comparison[data-size="xs"] .featureValue:nth-child(2) { padding-left: 16px; }
.comparison[data-size="xs"] .featureName { padding-inline: 16px; }
.comparison[data-size="xs"] .intro, .comparison[data-size="xs"] .filter, .comparison[data-size="xs"] .footer { padding-inline: 16px; }
@media (prefers-reduced-motion: reduce) {
  .planCell, .featureValue { transition: none; }
}

.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
```
