{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "comparison-table",
  "type": "registry:component",
  "title": "Comparison Table",
  "description": "A feature matrix with grouped rows, a sticky header and a glowing highlighted column. Rows highlight on hover and the table turns into stacked cards in narrow containers.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "comparison",
    "comparison",
    "table",
    "matrix",
    "features",
    "sticky",
    "section"
  ],
  "docs": "https://hyperblur.dev/effects/comparison-table",
  "files": [
    {
      "path": "registry/hyperblur/comparison-table.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/comparison-table.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport type ComparisonValue = boolean | string;\n\nexport interface ComparisonColumn {\n  name: string;\n  highlight?: boolean;\n  note?: string;\n}\n\nexport interface ComparisonGroup {\n  name: string;\n  rows: { label: string; values: ComparisonValue[] }[];\n}\n\nexport interface ComparisonTableProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  columns?: ComparisonColumn[];\n  groups?: ComparisonGroup[];\n  stickyOffset?: number;\n  cta?: { label: string; href: string } | null;\n  secondaryCta?: { label: string; href: string } | null;\n  accent?: string;\n}\n\nconst defaultColumns: ComparisonColumn[] = [\n  { name: \"Relay\", highlight: true, note: \"Recommended\" },\n  { name: \"Legacy CDN\" },\n  { name: \"Build it yourself\" },\n];\n\nconst defaultGroups: ComparisonGroup[] = [\n  {\n    name: \"Performance\",\n    rows: [\n      { label: \"Global edge locations\", values: [\"310\", \"84\", \"Up to you\"] },\n      { label: \"Median cold start\", values: [\"4 ms\", \"240 ms\", \"1.2 s\"] },\n      { label: \"On-the-fly image optimization\", values: [true, true, false] },\n      { label: \"HTTP/3 and early hints\", values: [true, false, \"Partial\"] },\n    ],\n  },\n  {\n    name: \"Developer experience\",\n    rows: [\n      { label: \"Deploy on git push\", values: [true, false, true] },\n      { label: \"Preview URL for every branch\", values: [true, false, false] },\n      { label: \"One-click rollbacks\", values: [true, \"Manual\", false] },\n    ],\n  },\n  {\n    name: \"Security\",\n    rows: [\n      { label: \"Always-on DDoS mitigation\", values: [true, true, false] },\n      { label: \"SOC 2 Type II report\", values: [true, true, false] },\n      { label: \"Managed TLS certificates\", values: [true, \"Paid add-on\", false] },\n    ],\n  },\n];\n\nconst css = `\n.hb-kc5 {\n  --hb-kc5-accent: #2f7bff;\n  container-type: inline-size;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-kc5 *, .hb-kc5 *::before, .hb-kc5 *::after { box-sizing: border-box; }\n.hb-kc5-inner { max-width: 1120px; margin: 0 auto; padding: 72px 18px 64px; }\n.hb-kc5-head { display: grid; gap: 14px; margin-bottom: 36px; }\n.hb-kc5-eyebrow { margin: 0; color: color-mix(in srgb, var(--hb-kc5-accent) 60%, #fff); font-size: 13px; font-weight: 600; letter-spacing: .04em; }\n.hb-kc5-title { margin: 0; max-width: 620px; font-size: clamp(30px, 5cqi, 46px); font-weight: 650; line-height: 1.06; letter-spacing: -.035em; text-wrap: balance; }\n.hb-kc5-sub { margin: 0; max-width: 440px; color: #8f8f8f; font-size: 16px; line-height: 1.6; text-wrap: pretty; }\n.hb-kc5-wrap { position: relative; display: none; }\n.hb-kc5-glow {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  left: var(--hb-kc5-left);\n  width: var(--hb-kc5-width);\n  overflow: hidden;\n  border: 1px solid color-mix(in srgb, var(--hb-kc5-accent) 45%, transparent);\n  border-radius: 18px;\n  background: linear-gradient(180deg, color-mix(in srgb, var(--hb-kc5-accent) 14%, #0d0d0f), color-mix(in srgb, var(--hb-kc5-accent) 5%, #0d0d0f) 40%, #0d0d0f);\n  box-shadow: 0 30px 80px -40px color-mix(in srgb, var(--hb-kc5-accent) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, .08);\n  pointer-events: none;\n}\n.hb-kc5-glow::after {\n  content: \"\";\n  position: absolute;\n  left: 0;\n  right: 0;\n  top: -30%;\n  height: 30%;\n  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--hb-kc5-accent) 22%, transparent), transparent);\n  animation: hb-kc5-sweep 5.5s cubic-bezier(.45, 0, .55, 1) infinite;\n}\n.hb-kc5-table { position: relative; width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 14px; }\n.hb-kc5-table th, .hb-kc5-table td { padding: 0 16px; text-align: center; }\n.hb-kc5-table thead th {\n  position: sticky;\n  top: var(--hb-kc5-top, 0px);\n  z-index: 2;\n  height: 84px;\n  padding-top: 8px;\n  border-bottom: 1px solid rgba(255, 255, 255, .08);\n  background: rgba(10, 10, 10, .82);\n  -webkit-backdrop-filter: blur(10px);\n  backdrop-filter: blur(10px);\n  vertical-align: middle;\n}\n.hb-kc5-table thead th:first-child { text-align: left; padding-left: 0; color: #6f6f6f; font-size: 12.5px; font-weight: 550; letter-spacing: .04em; text-transform: uppercase; }\n.hb-kc5-table thead th[data-us=\"true\"] {\n  border-radius: 18px 18px 0 0;\n  border-bottom-color: color-mix(in srgb, var(--hb-kc5-accent) 30%, transparent);\n  background: color-mix(in srgb, var(--hb-kc5-accent) 14%, #0d0d0f);\n  box-shadow: inset 1px 0 0 color-mix(in srgb, var(--hb-kc5-accent) 45%, transparent), inset -1px 0 0 color-mix(in srgb, var(--hb-kc5-accent) 45%, transparent), inset 0 1px 0 color-mix(in srgb, var(--hb-kc5-accent) 45%, transparent);\n  -webkit-backdrop-filter: none;\n  backdrop-filter: none;\n}\n.hb-kc5-colname { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }\n.hb-kc5-colname[data-us=\"false\"] { color: #a1a1a1; font-weight: 550; }\n.hb-kc5-mark { display: inline-flex; align-items: center; gap: 8px; }\n.hb-kc5-logo { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(135deg, color-mix(in srgb, var(--hb-kc5-accent) 50%, #fff), var(--hb-kc5-accent)); box-shadow: 0 0 16px color-mix(in srgb, var(--hb-kc5-accent) 60%, transparent); }\n.hb-kc5-note {\n  padding: 2px 8px;\n  border-radius: 999px;\n  background: color-mix(in srgb, var(--hb-kc5-accent) 20%, transparent);\n  color: color-mix(in srgb, var(--hb-kc5-accent) 50%, #fff);\n  font-size: 11px;\n  font-weight: 600;\n}\n.hb-kc5-group th {\n  height: 52px;\n  padding: 18px 0 8px;\n  color: #ededed;\n  font-size: 13px;\n  font-weight: 650;\n  text-align: left;\n  vertical-align: bottom;\n}\n.hb-kc5-row td, .hb-kc5-row th {\n  height: 50px;\n  border-top: 1px solid rgba(255, 255, 255, .06);\n  transition: background-color .2s ease;\n  animation: hb-kc5-in .6s cubic-bezier(.2, .8, .2, 1) both;\n  animation-delay: var(--hb-kc5-d, 0ms);\n}\n.hb-kc5-row th { padding-left: 12px; color: #c9c9c9; font-weight: 450; text-align: left; border-radius: 10px 0 0 10px; }\n.hb-kc5-row td:last-child { border-radius: 0 10px 10px 0; }\n.hb-kc5-row:hover td, .hb-kc5-row:hover th { background: rgba(255, 255, 255, .035); }\n.hb-kc5-row:hover th { color: #fff; }\n.hb-kc5-val { display: inline-flex; align-items: center; justify-content: center; color: #a1a1a1; font-size: 13.5px; font-variant-numeric: tabular-nums; }\n.hb-kc5-val[data-us=\"true\"] { color: #fff; font-weight: 600; }\n.hb-kc5-yes { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .08); color: #d4d4d4; }\n.hb-kc5-yes svg { width: 12px; height: 12px; }\n.hb-kc5-val[data-us=\"true\"] .hb-kc5-yes { background: var(--hb-kc5-accent); color: #fff; box-shadow: 0 0 14px color-mix(in srgb, var(--hb-kc5-accent) 60%, transparent); }\n.hb-kc5-no { display: block; width: 12px; height: 2px; border-radius: 2px; background: #3a3a3a; }\n.hb-kc5-cards { display: grid; gap: 22px; }\n.hb-kc5-cgroup h3 { margin: 0 0 10px; color: #ededed; font-size: 13px; font-weight: 650; }\n.hb-kc5-clist { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }\n.hb-kc5-card { padding: 14px 14px 12px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px; background: #101010; }\n.hb-kc5-card p { margin: 0 0 10px; color: #ededed; font-size: 14px; font-weight: 550; }\n.hb-kc5-cvals { display: grid; gap: 6px; margin: 0; }\n.hb-kc5-cvals div { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; padding: 0 10px; border-radius: 8px; font-size: 13px; }\n.hb-kc5-cvals div[data-us=\"true\"] { background: color-mix(in srgb, var(--hb-kc5-accent) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hb-kc5-accent) 35%, transparent); }\n.hb-kc5-cvals dt { color: #8f8f8f; }\n.hb-kc5-cvals div[data-us=\"true\"] dt { color: #fff; font-weight: 600; }\n.hb-kc5-cvals dd { margin: 0; }\n.hb-kc5-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 20px; margin-top: 40px; }\n.hb-kc5-cta {\n  display: inline-flex;\n  align-items: center;\n  height: 44px;\n  padding: 0 22px;\n  border-radius: 999px;\n  background: #fff;\n  color: #0a0a0a;\n  font-size: 14px;\n  font-weight: 650;\n  text-decoration: none;\n  transition: transform .2s cubic-bezier(.2, .8, .2, 1), background-color .2s ease;\n}\n.hb-kc5-cta:hover { transform: translateY(-1px); background: #ececec; }\n.hb-kc5-link { color: #a1a1a1; font-size: 14px; font-weight: 550; text-decoration: none; transition: color .2s ease; }\n.hb-kc5-link:hover { color: #fff; }\n.hb-kc5-cta:focus-visible, .hb-kc5-link:focus-visible { outline: 2px solid var(--hb-kc5-accent); outline-offset: 3px; }\n@keyframes hb-kc5-sweep {\n  0% { transform: translateY(0); }\n  70%, 100% { transform: translateY(440%); }\n}\n@keyframes hb-kc5-in {\n  from { opacity: 0; transform: translateY(6px); }\n  to { opacity: 1; transform: none; }\n}\n@container (min-width: 700px) {\n  .hb-kc5-inner { padding: 104px 32px 88px; }\n  .hb-kc5-head { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: end; gap: 32px; margin-bottom: 44px; }\n  .hb-kc5-wrap { display: block; }\n  .hb-kc5-cards { display: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-kc5-glow::after { animation: none; opacity: 0; }\n  .hb-kc5-row td, .hb-kc5-row th { animation: none; transition: none; }\n  .hb-kc5-cta, .hb-kc5-link { transition: none; }\n}\n`;\n\nfunction Cell({ value, us }: { value: ComparisonValue; us: boolean }) {\n  if (value === true) {\n    return (\n      <span className=\"hb-kc5-val\" data-us={us ? \"true\" : \"false\"}>\n        <span className=\"hb-kc5-yes\" role=\"img\" aria-label=\"Yes\">\n          <svg viewBox=\"0 0 12 12\" aria-hidden=\"true\">\n            <path d=\"M2.5 6.3l2.3 2.3 4.7-5.1\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.9\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n          </svg>\n        </span>\n      </span>\n    );\n  }\n  if (value === false) {\n    return (\n      <span className=\"hb-kc5-val\" data-us={us ? \"true\" : \"false\"}>\n        <span className=\"hb-kc5-no\" role=\"img\" aria-label=\"No\" />\n      </span>\n    );\n  }\n  return (\n    <span className=\"hb-kc5-val\" data-us={us ? \"true\" : \"false\"}>\n      {value}\n    </span>\n  );\n}\n\nexport function ComparisonTable({\n  eyebrow = \"Compare\",\n  title = \"Why teams move their sites to Relay\",\n  subtitle = \"The same features you would spend a quarter wiring together, on by default and priced per project.\",\n  columns = defaultColumns,\n  groups = defaultGroups,\n  stickyOffset = 0,\n  cta = { label: \"Deploy your first site\", href: \"#\" },\n  secondaryCta = { label: \"Read the migration guide\", href: \"#\" },\n  accent = \"#2f7bff\",\n  className = \"\",\n  style,\n  ...rest\n}: ComparisonTableProps) {\n  const first = 34;\n  const colW = (100 - first) / Math.max(1, columns.length);\n  const usIndex = columns.findIndex((c) => c.highlight);\n  const offsets = groups.map((_, gi) => groups.slice(0, gi).reduce((n, g) => n + g.rows.length, 0));\n\n  const vars = {\n    \"--hb-kc5-accent\": accent,\n    \"--hb-kc5-top\": `${stickyOffset}px`,\n    \"--hb-kc5-left\": `${(first + Math.max(0, usIndex) * colW).toFixed(3)}%`,\n    \"--hb-kc5-width\": `${colW.toFixed(3)}%`,\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <section className={`hb-kc5 ${className}`} style={vars} {...rest}>\n      <style href=\"hb-comparison-table\" precedence=\"default\">{css}</style>\n      <div className=\"hb-kc5-inner\">\n        <div className=\"hb-kc5-head\">\n          <div>\n            {eyebrow ? <p className=\"hb-kc5-eyebrow\">{eyebrow}</p> : null}\n            <h2 className=\"hb-kc5-title\">{title}</h2>\n          </div>\n          {subtitle ? <p className=\"hb-kc5-sub\">{subtitle}</p> : null}\n        </div>\n        <div className=\"hb-kc5-wrap\">\n          {usIndex >= 0 ? <span className=\"hb-kc5-glow\" aria-hidden=\"true\" /> : null}\n          <table className=\"hb-kc5-table\">\n            <colgroup>\n              <col style={{ width: `${first}%` }} />\n              {columns.map((c) => (\n                <col key={c.name} style={{ width: `${colW.toFixed(3)}%` }} />\n              ))}\n            </colgroup>\n            <thead>\n              <tr>\n                <th scope=\"col\">Feature</th>\n                {columns.map((c) => (\n                  <th key={c.name} scope=\"col\" data-us={c.highlight ? \"true\" : \"false\"}>\n                    <span className=\"hb-kc5-colname\" data-us={c.highlight ? \"true\" : \"false\"}>\n                      <span className=\"hb-kc5-mark\">\n                        {c.highlight ? <span className=\"hb-kc5-logo\" aria-hidden=\"true\" /> : null}\n                        {c.name}\n                      </span>\n                      {c.note ? <span className=\"hb-kc5-note\">{c.note}</span> : null}\n                    </span>\n                  </th>\n                ))}\n              </tr>\n            </thead>\n            {groups.map((g, gi) => (\n              <tbody key={g.name}>\n                <tr className=\"hb-kc5-group\">\n                  <th scope=\"colgroup\" colSpan={columns.length + 1}>{g.name}</th>\n                </tr>\n                {g.rows.map((r, ri) => {\n                  const d = ((offsets[gi] ?? 0) + ri) * 45;\n                  return (\n                    <tr key={r.label} className=\"hb-kc5-row\" style={{ \"--hb-kc5-d\": `${d}ms` } as React.CSSProperties}>\n                      <th scope=\"row\">{r.label}</th>\n                      {columns.map((c, i) => (\n                        <td key={c.name}>\n                          <Cell value={r.values[i] ?? false} us={!!c.highlight} />\n                        </td>\n                      ))}\n                    </tr>\n                  );\n                })}\n              </tbody>\n            ))}\n          </table>\n        </div>\n        <div className=\"hb-kc5-cards\">\n          {groups.map((g) => (\n            <div key={g.name} className=\"hb-kc5-cgroup\">\n              <h3>{g.name}</h3>\n              <ul className=\"hb-kc5-clist\">\n                {g.rows.map((r) => (\n                  <li key={r.label} className=\"hb-kc5-card\">\n                    <p>{r.label}</p>\n                    <dl className=\"hb-kc5-cvals\">\n                      {columns.map((c, i) => (\n                        <div key={c.name} data-us={c.highlight ? \"true\" : \"false\"}>\n                          <dt>{c.name}</dt>\n                          <dd>\n                            <Cell value={r.values[i] ?? false} us={!!c.highlight} />\n                          </dd>\n                        </div>\n                      ))}\n                    </dl>\n                  </li>\n                ))}\n              </ul>\n            </div>\n          ))}\n        </div>\n        {cta || secondaryCta ? (\n          <div className=\"hb-kc5-actions\">\n            {cta ? <a className=\"hb-kc5-cta\" href={cta.href}>{cta.label}</a> : null}\n            {secondaryCta ? <a className=\"hb-kc5-link\" href={secondaryCta.href}>{secondaryCta.label}</a> : null}\n          </div>\n        ) : null}\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}