{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-feature-table",
  "type": "registry:component",
  "title": "Pricing Feature Table",
  "description": "A dark comparison table with a sticky blurred header of plans and prices, collapsible feature groups, a monthly or yearly switch that flips the prices, and plan tabs on narrow containers.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "pricing",
    "pricing",
    "comparison",
    "table",
    "sticky header",
    "toggle",
    "features"
  ],
  "docs": "https://hyperblur.dev/effects/pricing-feature-table",
  "files": [
    {
      "path": "registry/hyperblur/pricing-feature-table.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/pricing-feature-table.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport type PricingTableBilling = \"monthly\" | \"yearly\";\nexport type PricingTableValue = boolean | string;\n\nexport interface PricingTablePlan {\n  name: string;\n  monthly: number | null;\n  yearly: number | null;\n  note: string;\n  cta: { label: string; href: string };\n  highlight?: boolean;\n}\n\nexport interface PricingTableGroup {\n  name: string;\n  rows: { feature: string; hint?: string; values: PricingTableValue[] }[];\n}\n\nexport interface PricingFeatureTableProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  plans?: PricingTablePlan[];\n  groups?: PricingTableGroup[];\n  billing?: PricingTableBilling;\n  defaultBilling?: PricingTableBilling;\n  onBillingChange?: (billing: PricingTableBilling) => void;\n  stickyTop?: number;\n  currency?: string;\n  accent?: string;\n}\n\nconst defaultPlans: PricingTablePlan[] = [\n  { name: \"Hobby\", monthly: 0, yearly: 0, note: \"For side projects\", cta: { label: \"Start free\", href: \"#\" } },\n  { name: \"Pro\", monthly: 24, yearly: 19, note: \"Per member\", cta: { label: \"Start trial\", href: \"#\" }, highlight: true },\n  { name: \"Scale\", monthly: 79, yearly: 63, note: \"Per member\", cta: { label: \"Start trial\", href: \"#\" } },\n  { name: \"Enterprise\", monthly: null, yearly: null, note: \"Annual contract\", cta: { label: \"Contact sales\", href: \"#\" } },\n];\n\nconst defaultGroups: PricingTableGroup[] = [\n  {\n    name: \"Workspace\",\n    rows: [\n      { feature: \"Projects\", values: [\"3\", \"Unlimited\", \"Unlimited\", \"Unlimited\"] },\n      { feature: \"Members\", values: [\"1\", \"Up to 25\", \"Up to 200\", \"Unlimited\"] },\n      { feature: \"File storage\", hint: \"Per workspace\", values: [\"2 GB\", \"100 GB\", \"1 TB\", \"Custom\"] },\n      { feature: \"Version history\", values: [\"7 days\", \"90 days\", \"1 year\", \"Unlimited\"] },\n    ],\n  },\n  {\n    name: \"Collaboration\",\n    rows: [\n      { feature: \"Guest access\", values: [false, true, true, true] },\n      { feature: \"Comments and mentions\", values: [true, true, true, true] },\n      { feature: \"Approval flows\", values: [false, false, true, true] },\n      { feature: \"Shared templates\", values: [false, true, true, true] },\n    ],\n  },\n  {\n    name: \"Security\",\n    rows: [\n      { feature: \"Two-factor authentication\", values: [true, true, true, true] },\n      { feature: \"SAML single sign-on\", values: [false, false, true, true] },\n      { feature: \"Audit log\", values: [false, false, \"30 days\", \"Unlimited\"] },\n      { feature: \"Data residency\", values: [false, false, false, true] },\n    ],\n  },\n  {\n    name: \"Support\",\n    rows: [\n      { feature: \"Help center and community\", values: [true, true, true, true] },\n      { feature: \"Response time\", values: [\"-\", \"24 hours\", \"4 hours\", \"1 hour\"] },\n      { feature: \"Dedicated success manager\", values: [false, false, false, true] },\n    ],\n  },\n];\n\nconst css = `\n.hb-yia {\n  --hb-yia-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-yia *, .hb-yia *::before, .hb-yia *::after { box-sizing: border-box; }\n.hb-yia-inner { max-width: 1120px; margin: 0 auto; padding: 72px 20px 80px; }\n.hb-yia-head { display: grid; gap: 22px; align-items: end; margin-bottom: 36px; }\n.hb-yia-eyebrow { margin: 0 0 12px; font-size: 13px; font-weight: 500; color: color-mix(in srgb, var(--hb-yia-accent) 60%, #fff); }\n.hb-yia-title { margin: 0; font-size: clamp(30px, 4.6cqi, 48px); line-height: 1.05; letter-spacing: -.04em; font-weight: 600; }\n.hb-yia-sub { margin: 12px 0 0; max-width: 460px; font-size: 15px; line-height: 1.6; color: #8f8f8f; }\n.hb-yia-toggle { display: inline-flex; align-items: center; gap: 12px; justify-self: start; font-size: 14px; color: #8f8f8f; }\n.hb-yia-switch {\n  position: relative; width: 46px; height: 26px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .12); background: #1a1a1a; cursor: pointer; padding: 0;\n  transition: background .25s, border-color .25s;\n}\n.hb-yia-switch::after { content: \"\"; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #ededed; transition: transform .35s cubic-bezier(.3, 1.4, .5, 1); }\n.hb-yia-switch[aria-checked=\"true\"] { background: var(--hb-yia-accent); border-color: transparent; }\n.hb-yia-switch[aria-checked=\"true\"]::after { transform: translateX(20px); background: #fff; }\n.hb-yia-switch:focus-visible, .hb-yia-tab:focus-visible, .hb-yia-gbtn:focus-visible, .hb-yia-cta:focus-visible { outline: 2px solid var(--hb-yia-accent); outline-offset: 2px; }\n.hb-yia-toggle span[data-on=\"true\"] { color: #ededed; }\n.hb-yia-save { padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; color: #4ade80; background: rgba(74, 222, 128, .12); }\n.hb-yia-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 12px; background: #111; border: 1px solid rgba(255, 255, 255, .08); }\n.hb-yia-tab { flex: 1; height: 34px; border: 0; border-radius: 9px; background: transparent; color: #8f8f8f; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }\n.hb-yia-tab[aria-selected=\"true\"] { background: #222; color: #fff; }\n.hb-yia-table { --hb-yia-cols: 4; position: relative; border-radius: 20px; border: 1px solid rgba(255, 255, 255, .08); background: #0d0d0d; }\n.hb-yia-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }\n.hb-yia-cell[data-sel=\"false\"] { display: none; }\n.hb-yia-sticky {\n  position: sticky; top: var(--hb-yia-top, 0px); z-index: 2; border-radius: 20px 20px 0 0;\n  background: rgba(13, 13, 13, .82); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);\n  border-bottom: 1px solid rgba(255, 255, 255, .08);\n}\n.hb-yia-corner { padding: 22px 20px; display: flex; align-items: flex-end; font-size: 13px; color: #6f6f6f; }\n.hb-yia-plan { position: relative; padding: 22px 16px 18px; display: flex; flex-direction: column; gap: 4px; }\n.hb-yia-plan[data-hl=\"true\"]::before {\n  content: \"\"; position: absolute; inset: 0 0 0 0; border-radius: 16px 16px 0 0;\n  background: linear-gradient(180deg, color-mix(in srgb, var(--hb-yia-accent) 18%, transparent), transparent);\n  border-top: 2px solid var(--hb-yia-accent);\n}\n.hb-yia-plan > * { position: relative; }\n.hb-yia-pname { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }\n.hb-yia-pop { padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; background: var(--hb-yia-accent); color: #fff; }\n.hb-yia-amount { display: flex; align-items: baseline; gap: 4px; margin-top: 6px; perspective: 400px; }\n.hb-yia-num { display: inline-block; font-size: 30px; line-height: 1; letter-spacing: -.04em; font-weight: 600; font-variant-numeric: tabular-nums; animation: hb-yia-flip .55s cubic-bezier(.2, .9, .25, 1) both; transform-origin: 50% 0; }\n.hb-yia-unit { font-size: 13px; color: #8f8f8f; }\n.hb-yia-note { font-size: 12px; color: #6f6f6f; }\n.hb-yia-cta {\n  display: inline-flex; align-items: center; justify-content: center; height: 36px; margin-top: 12px; border-radius: 10px; font-size: 13px; font-weight: 600; text-decoration: none;\n  color: #ededed; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .02); transition: background .2s, border-color .2s, transform .2s;\n}\n.hb-yia-cta:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .25); }\n.hb-yia-plan[data-hl=\"true\"] .hb-yia-cta { background: var(--hb-yia-accent); border-color: transparent; color: #fff; box-shadow: 0 10px 24px -12px var(--hb-yia-accent); }\n.hb-yia-plan[data-hl=\"true\"] .hb-yia-cta:hover { transform: translateY(-1px); }\n.hb-yia-group + .hb-yia-group { border-top: 1px solid rgba(255, 255, 255, .06); }\n.hb-yia-gbtn {\n  display: flex; align-items: center; gap: 10px; width: 100%; padding: 18px 20px 10px; border: 0; background: transparent; color: #ededed; font: inherit; font-size: 13px;\n  font-weight: 600; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; text-align: left;\n}\n.hb-yia-gbtn svg { width: 14px; height: 14px; color: #6f6f6f; transition: transform .3s cubic-bezier(.3, 1.3, .5, 1); }\n.hb-yia-gbtn[aria-expanded=\"false\"] svg { transform: rotate(-90deg); }\n.hb-yia-gbtn small { margin-left: auto; font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; color: #5f5f5f; }\n.hb-yia-rows { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .4s cubic-bezier(.2, .8, .2, 1); }\n.hb-yia-rows[data-open=\"false\"] { grid-template-rows: 0fr; }\n.hb-yia-rows > div { overflow: hidden; min-height: 0; }\n.hb-yia-frow { transition: background .2s; animation: hb-yia-row .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--hb-yia-i) * 35ms); }\n.hb-yia-frow:hover { background: rgba(255, 255, 255, .025); }\n.hb-yia-frow > div { padding: 13px 16px; font-size: 14px; display: flex; align-items: center; border-top: 1px solid rgba(255, 255, 255, .045); }\n.hb-yia-frow > div:first-child { padding-left: 20px; color: #c9c9c9; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }\n.hb-yia-frow small { font-size: 12px; color: #5f5f5f; }\n.hb-yia-frow > div[data-hl=\"true\"] { background: color-mix(in srgb, var(--hb-yia-accent) 5%, transparent); }\n.hb-yia-yes { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--hb-yia-accent) 18%, transparent); color: color-mix(in srgb, var(--hb-yia-accent) 50%, #fff); }\n.hb-yia-yes svg { width: 12px; height: 12px; }\n.hb-yia-no { width: 12px; height: 1.5px; border-radius: 1px; background: #3a3a3a; }\n.hb-yia-txt { color: #ededed; font-variant-numeric: tabular-nums; }\n.hb-yia-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n@keyframes hb-yia-flip { from { opacity: 0; transform: rotateX(-80deg); } to { opacity: 1; transform: none; } }\n@keyframes hb-yia-row { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }\n@container (min-width: 720px) {\n  .hb-yia-inner { padding: 104px 32px 112px; }\n  .hb-yia-head { grid-template-columns: minmax(0, 1fr) auto; }\n  .hb-yia-toggle { justify-self: end; }\n  .hb-yia-tabs { display: none; }\n  .hb-yia-row { grid-template-columns: minmax(0, 1.4fr) repeat(var(--hb-yia-cols), minmax(0, 1fr)); }\n  .hb-yia-cell[data-sel=\"false\"] { display: flex; }\n  .hb-yia-sticky .hb-yia-cell[data-sel=\"false\"] { display: flex; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-yia-num, .hb-yia-frow { animation: none; }\n  .hb-yia-rows, .hb-yia-gbtn svg, .hb-yia-switch, .hb-yia-switch::after, .hb-yia-cta { transition: none; }\n}\n`;\n\nfunction Value({ v }: { v: PricingTableValue }) {\n  if (v === true) {\n    return (\n      <span className=\"hb-yia-yes\">\n        <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n          <path d=\"M5 12.5l4.5 4.5L19 7.5\" />\n        </svg>\n        <span className=\"hb-yia-sr\">Included</span>\n      </span>\n    );\n  }\n  if (v === false) {\n    return (\n      <span className=\"hb-yia-no\">\n        <span className=\"hb-yia-sr\">Not included</span>\n      </span>\n    );\n  }\n  return <span className=\"hb-yia-txt\">{v}</span>;\n}\n\nexport function PricingFeatureTable({\n  eyebrow = \"Compare plans\",\n  title = \"Every feature, side by side.\",\n  subtitle = \"All plans include unlimited viewers, real-time sync and a 99.9 percent uptime commitment.\",\n  plans = defaultPlans,\n  groups = defaultGroups,\n  billing,\n  defaultBilling = \"yearly\",\n  onBillingChange,\n  stickyTop = 0,\n  currency = \"$\",\n  accent = \"#2f7bff\",\n  className = \"\",\n  style,\n  ...rest\n}: PricingFeatureTableProps) {\n  const [innerBilling, setInnerBilling] = React.useState<PricingTableBilling>(defaultBilling);\n  const [closed, setClosed] = React.useState<string[]>([]);\n  const [pick, setPick] = React.useState(() => Math.max(0, plans.findIndex((p) => p.highlight)));\n  const mode = billing ?? innerBilling;\n  const id = React.useId();\n\n  const setMode = (m: PricingTableBilling) => {\n    if (billing === undefined) setInnerBilling(m);\n    onBillingChange?.(m);\n  };\n\n  const savings = plans.reduce((best, p) => {\n    if (!p.monthly || p.yearly === null) return best;\n    return Math.max(best, Math.round((1 - p.yearly / p.monthly) * 100));\n  }, 0);\n\n  const onTabKey = (e: React.KeyboardEvent) => {\n    if (e.key !== \"ArrowRight\" && e.key !== \"ArrowLeft\") return;\n    e.preventDefault();\n    const next = (pick + (e.key === \"ArrowRight\" ? 1 : -1) + plans.length) % plans.length;\n    setPick(next);\n    const el = document.getElementById(`${id}-tab-${next}`);\n    el?.focus();\n  };\n\n  let rowIndex = 0;\n  const vars = { \"--hb-yia-accent\": accent, \"--hb-yia-top\": `${stickyTop}px`, ...style } as React.CSSProperties;\n\n  return (\n    <section className={`hb-yia ${className}`} style={vars} {...rest}>\n      <style href=\"hb-pricing-feature-table\" precedence=\"default\">{css}</style>\n      <div className=\"hb-yia-inner\">\n        <div className=\"hb-yia-head\">\n          <div>\n            {eyebrow ? <p className=\"hb-yia-eyebrow\">{eyebrow}</p> : null}\n            <h2 className=\"hb-yia-title\">{title}</h2>\n            {subtitle ? <p className=\"hb-yia-sub\">{subtitle}</p> : null}\n          </div>\n          <div className=\"hb-yia-toggle\">\n            <span data-on={mode === \"monthly\"} id={`${id}-m`}>Monthly</span>\n            <button\n              type=\"button\"\n              role=\"switch\"\n              className=\"hb-yia-switch\"\n              aria-checked={mode === \"yearly\"}\n              aria-label=\"Bill yearly\"\n              onClick={() => setMode(mode === \"yearly\" ? \"monthly\" : \"yearly\")}\n            />\n            <span data-on={mode === \"yearly\"}>Yearly</span>\n            {savings ? <span className=\"hb-yia-save\">{`Save up to ${savings}%`}</span> : null}\n          </div>\n        </div>\n\n        <div className=\"hb-yia-tabs\" role=\"tablist\" aria-label=\"Plan\">\n          {plans.map((p, i) => (\n            <button\n              key={p.name}\n              id={`${id}-tab-${i}`}\n              type=\"button\"\n              role=\"tab\"\n              className=\"hb-yia-tab\"\n              aria-selected={pick === i}\n              tabIndex={pick === i ? 0 : -1}\n              onClick={() => setPick(i)}\n              onKeyDown={onTabKey}\n            >\n              {p.name}\n            </button>\n          ))}\n        </div>\n\n        <div className=\"hb-yia-table\" style={{ \"--hb-yia-cols\": plans.length } as React.CSSProperties} role=\"table\" aria-label=\"Plan comparison\">\n          <div className=\"hb-yia-row hb-yia-sticky\" role=\"row\">\n            <div className=\"hb-yia-corner\" role=\"columnheader\">\n              {mode === \"yearly\" ? \"Prices per month, billed yearly\" : \"Prices per month\"}\n            </div>\n            {plans.map((p, i) => {\n              const price = mode === \"yearly\" ? p.yearly : p.monthly;\n              return (\n                <div key={p.name} className=\"hb-yia-plan hb-yia-cell\" data-sel={pick === i} data-hl={!!p.highlight} role=\"columnheader\">\n                  <span className=\"hb-yia-pname\">\n                    {p.name}\n                    {p.highlight ? <span className=\"hb-yia-pop\">Popular</span> : null}\n                  </span>\n                  <span className=\"hb-yia-amount\">\n                    <span key={`${mode}-${p.name}`} className=\"hb-yia-num\">\n                      {price === null ? \"Custom\" : `${currency}${price}`}\n                    </span>\n                    {price !== null && price > 0 ? <span className=\"hb-yia-unit\">/mo</span> : null}\n                  </span>\n                  <span className=\"hb-yia-note\">{p.note}</span>\n                  <a className=\"hb-yia-cta\" href={p.cta.href}>\n                    {p.cta.label}\n                  </a>\n                </div>\n              );\n            })}\n          </div>\n\n          {groups.map((g) => {\n            const open = !closed.includes(g.name);\n            const panelId = `${id}-${g.name.replace(/\\s+/g, \"-\")}`;\n            return (\n              <div key={g.name} className=\"hb-yia-group\" role=\"rowgroup\">\n                <div role=\"row\">\n                  <div role=\"rowheader\">\n                    <button\n                      type=\"button\"\n                      className=\"hb-yia-gbtn\"\n                      aria-expanded={open}\n                      aria-controls={panelId}\n                      onClick={() => setClosed((c) => (open ? [...c, g.name] : c.filter((x) => x !== g.name)))}\n                    >\n                      <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                        <path d=\"M6 9l6 6 6-6\" />\n                      </svg>\n                      {g.name}\n                      <small>{`${g.rows.length} features`}</small>\n                    </button>\n                  </div>\n                </div>\n                <div className=\"hb-yia-rows\" data-open={open} id={panelId}>\n                  <div>\n                    {g.rows.map((r) => {\n                      const i = rowIndex++;\n                      return (\n                        <div key={r.feature} className=\"hb-yia-row hb-yia-frow\" role=\"row\" style={{ \"--hb-yia-i\": i } as React.CSSProperties}>\n                          <div role=\"rowheader\">\n                            {r.feature}\n                            {r.hint ? <small>{r.hint}</small> : null}\n                          </div>\n                          {plans.map((p, c) => (\n                            <div key={p.name} className=\"hb-yia-cell\" data-sel={pick === c} data-hl={!!p.highlight} role=\"cell\">\n                              <Value v={r.values[c] ?? false} />\n                            </div>\n                          ))}\n                        </div>\n                      );\n                    })}\n                  </div>\n                </div>\n              </div>\n            );\n          })}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}