{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-switch",
  "type": "registry:component",
  "title": "Pricing Switch",
  "description": "Three tiers in one joined panel with a sliding monthly and yearly switch. Prices roll like an odometer when the period changes and the featured tier glows with a rotating border.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "pricing",
    "pricing",
    "plans",
    "odometer",
    "billing toggle",
    "tiers",
    "section"
  ],
  "docs": "https://hyperblur.dev/effects/pricing-switch",
  "files": [
    {
      "path": "registry/hyperblur/pricing-switch.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/pricing-switch.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport type PricingSwitchPeriod = \"monthly\" | \"yearly\";\n\nexport interface PricingSwitchTier {\n  name: string;\n  description: string;\n  monthly: number;\n  yearly: number;\n  features: string[];\n  cta: { label: string; href: string };\n  featured?: boolean;\n  badge?: string;\n}\n\nexport interface PricingSwitchProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  tiers?: PricingSwitchTier[];\n  currency?: string;\n  period?: PricingSwitchPeriod;\n  defaultPeriod?: PricingSwitchPeriod;\n  onPeriodChange?: (period: PricingSwitchPeriod) => void;\n  saveLabel?: string;\n  footnote?: string;\n  accent?: string;\n}\n\nconst defaultTiers: PricingSwitchTier[] = [\n  {\n    name: \"Hobby\",\n    description: \"For side projects and weekend experiments.\",\n    monthly: 0,\n    yearly: 0,\n    features: [\"3 projects\", \"10k monthly visitors\", \"Community support\", \"7-day analytics\"],\n    cta: { label: \"Start for free\", href: \"#\" },\n  },\n  {\n    name: \"Pro\",\n    description: \"For freelancers and small teams shipping weekly.\",\n    monthly: 29,\n    yearly: 23,\n    features: [\"Unlimited projects\", \"250k monthly visitors\", \"Preview deployments\", \"Password protection\", \"Email support in 24h\"],\n    cta: { label: \"Start 14-day trial\", href: \"#\" },\n    featured: true,\n    badge: \"Most popular\",\n  },\n  {\n    name: \"Scale\",\n    description: \"For companies that need control and guarantees.\",\n    monthly: 99,\n    yearly: 79,\n    features: [\"Everything in Pro\", \"2M monthly visitors\", \"SAML SSO and audit log\", \"99.99% uptime SLA\", \"Dedicated Slack channel\"],\n    cta: { label: \"Talk to sales\", href: \"#\" },\n  },\n];\n\nconst css = `\n.hb-kc1 {\n  --hb-kc1-accent: #8b5cf6;\n  container-type: inline-size;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  isolation: isolate;\n  overflow: hidden;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-kc1 *, .hb-kc1 *::before, .hb-kc1 *::after { box-sizing: border-box; }\n.hb-kc1::before {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  z-index: -1;\n  background:\n    radial-gradient(50% 40% at 50% 62%, color-mix(in srgb, var(--hb-kc1-accent) 22%, transparent), transparent 70%),\n    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px) 0 0 / 48px 48px,\n    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px) 0 0 / 48px 48px;\n  -webkit-mask-image: radial-gradient(80% 70% at 50% 40%, #000 30%, transparent 85%);\n  mask-image: radial-gradient(80% 70% at 50% 40%, #000 30%, transparent 85%);\n  pointer-events: none;\n}\n.hb-kc1-inner { max-width: 1120px; margin: 0 auto; padding: 72px 18px 64px; }\n.hb-kc1-head { display: flex; flex-direction: column; gap: 24px; }\n.hb-kc1-eyebrow {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  margin: 0 0 14px;\n  color: color-mix(in srgb, var(--hb-kc1-accent) 60%, #fff);\n  font-size: 13px;\n  font-weight: 600;\n  letter-spacing: .08em;\n  text-transform: uppercase;\n}\n.hb-kc1-eyebrow::before {\n  content: \"\";\n  width: 18px;\n  height: 1px;\n  background: currentColor;\n}\n.hb-kc1-title {\n  margin: 0;\n  max-width: 620px;\n  font-size: clamp(30px, 5cqi, 48px);\n  font-weight: 650;\n  line-height: 1.06;\n  letter-spacing: -.035em;\n  text-wrap: balance;\n}\n.hb-kc1-sub {\n  margin: 14px 0 0;\n  max-width: 520px;\n  color: #8f8f8f;\n  font-size: 16px;\n  line-height: 1.6;\n  text-wrap: pretty;\n}\n.hb-kc1-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }\n.hb-kc1-switch {\n  position: relative;\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  padding: 4px;\n  border: 1px solid rgba(255, 255, 255, .1);\n  border-radius: 999px;\n  background: #111;\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);\n}\n.hb-kc1-pill {\n  position: absolute;\n  top: 4px;\n  bottom: 4px;\n  left: 4px;\n  width: calc(50% - 4px);\n  border-radius: 999px;\n  background: linear-gradient(180deg, #2a2a2e, #1c1c20);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 6px 16px -6px rgba(0, 0, 0, .8);\n  transition: transform .5s cubic-bezier(.65, 0, .2, 1.25);\n}\n.hb-kc1-switch[data-period=\"yearly\"] .hb-kc1-pill { transform: translateX(100%); }\n.hb-kc1-opt {\n  position: relative;\n  z-index: 1;\n  min-width: 96px;\n  height: 36px;\n  padding: 0 18px;\n  border: 0;\n  border-radius: 999px;\n  background: none;\n  color: #8f8f8f;\n  font: inherit;\n  font-size: 14px;\n  font-weight: 550;\n  cursor: pointer;\n  transition: color .3s ease;\n}\n.hb-kc1-opt[aria-checked=\"true\"] { color: #fff; }\n.hb-kc1-opt:focus-visible { outline: 2px solid var(--hb-kc1-accent); outline-offset: 2px; }\n.hb-kc1-save {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  height: 28px;\n  padding: 0 12px;\n  border: 1px solid rgba(255, 255, 255, .1);\n  border-radius: 999px;\n  color: #8f8f8f;\n  font-size: 12.5px;\n  font-weight: 600;\n  white-space: nowrap;\n  transition: color .3s ease, border-color .3s ease, background-color .3s ease, transform .4s cubic-bezier(.3, 1.6, .5, 1);\n}\n.hb-kc1-save svg { width: 12px; height: 12px; }\n.hb-kc1-save[data-on=\"true\"] {\n  border-color: color-mix(in srgb, var(--hb-kc1-accent) 50%, transparent);\n  background: color-mix(in srgb, var(--hb-kc1-accent) 16%, transparent);\n  color: color-mix(in srgb, var(--hb-kc1-accent) 55%, #fff);\n  transform: scale(1.04);\n}\n.hb-kc1-panel {\n  display: grid;\n  grid-template-columns: 1fr;\n  margin: 44px 0 0;\n  padding: 0;\n  list-style: none;\n  border: 1px solid rgba(255, 255, 255, .08);\n  border-radius: 24px;\n  background: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, .01));\n}\n.hb-kc1-tier { position: relative; display: flex; flex-direction: column; padding: 28px 24px; }\n.hb-kc1-tier + .hb-kc1-tier { border-top: 1px solid rgba(255, 255, 255, .08); }\n.hb-kc1-tier[data-featured=\"true\"] {\n  z-index: 1;\n  margin: -1px;\n  padding: 1px;\n  border: 0;\n  border-radius: 24px;\n  overflow: hidden;\n  isolation: isolate;\n  background: color-mix(in srgb, var(--hb-kc1-accent) 35%, rgba(255, 255, 255, .1));\n  box-shadow: 0 40px 90px -40px color-mix(in srgb, var(--hb-kc1-accent) 80%, transparent), 0 0 0 1px rgba(0, 0, 0, .5);\n}\n.hb-kc1-tier[data-featured=\"true\"] + .hb-kc1-tier { border-top: 0; }\n.hb-kc1-tier[data-featured=\"true\"]::before {\n  content: \"\";\n  position: absolute;\n  left: 50%;\n  top: 50%;\n  z-index: -1;\n  width: 260%;\n  aspect-ratio: 1;\n  background: conic-gradient(from 0deg, transparent 0 58%, color-mix(in srgb, var(--hb-kc1-accent) 70%, transparent) 70%, #fff 76%, var(--hb-kc1-accent) 82%, transparent 92%);\n  transform: translate(-50%, -50%) rotate(0deg);\n  animation: hb-kc1-spin 7s linear infinite;\n}\n.hb-kc1-body { display: flex; flex: 1; flex-direction: column; }\n.hb-kc1-tier[data-featured=\"true\"] .hb-kc1-body {\n  padding: 27px 23px;\n  border-radius: 23px;\n  background:\n    radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--hb-kc1-accent) 18%, transparent), transparent 70%),\n    #0e0e10;\n}\n.hb-kc1-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }\n.hb-kc1-name { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }\n.hb-kc1-badge {\n  height: 24px;\n  padding: 0 10px;\n  border-radius: 999px;\n  background: color-mix(in srgb, var(--hb-kc1-accent) 22%, transparent);\n  color: color-mix(in srgb, var(--hb-kc1-accent) 50%, #fff);\n  font-size: 11.5px;\n  font-weight: 600;\n  line-height: 24px;\n  white-space: nowrap;\n}\n.hb-kc1-desc { margin: 8px 0 0; min-height: 2.9em; color: #8f8f8f; font-size: 14px; line-height: 1.45; }\n.hb-kc1-price { display: flex; align-items: flex-end; gap: 6px; margin-top: 22px; }\n.hb-kc1-amount {\n  display: inline-flex;\n  align-items: flex-start;\n  font-size: 52px;\n  font-weight: 650;\n  letter-spacing: -.04em;\n  line-height: 1;\n  font-variant-numeric: tabular-nums;\n}\n.hb-kc1-cur { margin: .1em .04em 0 0; color: #a1a1a1; font-size: .46em; font-weight: 550; letter-spacing: 0; }\n.hb-kc1-odo { display: inline-flex; }\n.hb-kc1-slot {\n  display: inline-block;\n  height: 1.1em;\n  max-width: 1em;\n  overflow: hidden;\n  transition: max-width .5s cubic-bezier(.65, 0, .2, 1);\n}\n.hb-kc1-slot[data-empty=\"true\"] { max-width: 0; }\n.hb-kc1-reel {\n  display: flex;\n  flex-direction: column;\n  transition: transform .9s cubic-bezier(.3, 1.35, .45, 1);\n  transition-delay: var(--hb-kc1-d, 0ms);\n}\n.hb-kc1-reel span { display: block; height: 1.1em; line-height: 1.1em; text-align: center; }\n.hb-kc1-per { padding-bottom: 8px; color: #8f8f8f; font-size: 14px; }\n.hb-kc1-bill { margin: 8px 0 0; min-height: 1.4em; color: #6f6f6f; font-size: 13px; }\n.hb-kc1-cta {\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: 8px;\n  height: 42px;\n  margin-top: 22px;\n  border: 1px solid rgba(255, 255, 255, .12);\n  border-radius: 999px;\n  background: rgba(255, 255, 255, .03);\n  color: #ededed;\n  font-size: 14px;\n  font-weight: 600;\n  text-decoration: none;\n  transition: background-color .25s ease, border-color .25s ease, transform .25s cubic-bezier(.2, .8, .2, 1);\n}\n.hb-kc1-cta:hover { border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .07); }\n.hb-kc1-cta:active { transform: scale(.98); }\n.hb-kc1-cta:focus-visible { outline: 2px solid var(--hb-kc1-accent); outline-offset: 3px; }\n.hb-kc1-cta svg { width: 14px; height: 14px; transition: transform .25s ease; }\n.hb-kc1-cta:hover svg { transform: translateX(3px); }\n.hb-kc1-tier[data-featured=\"true\"] .hb-kc1-cta {\n  border-color: transparent;\n  background: #fff;\n  color: #0a0a0a;\n  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--hb-kc1-accent) 90%, transparent);\n}\n.hb-kc1-tier[data-featured=\"true\"] .hb-kc1-cta:hover { background: #f0f0f0; }\n.hb-kc1-list { display: grid; gap: 11px; margin: 24px 0 0; padding: 22px 0 0; border-top: 1px dashed rgba(255, 255, 255, .1); list-style: none; }\n.hb-kc1-list li { display: flex; align-items: flex-start; gap: 10px; color: #c9c9c9; font-size: 14px; line-height: 1.4; }\n.hb-kc1-list svg { flex: none; width: 16px; height: 16px; margin-top: 1px; color: color-mix(in srgb, var(--hb-kc1-accent) 65%, #fff); }\n.hb-kc1-foot {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  justify-content: center;\n  gap: 8px 22px;\n  margin: 32px 0 0;\n  color: #6f6f6f;\n  font-size: 13px;\n  text-align: center;\n}\n.hb-kc1-sr {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  clip-path: inset(50%);\n  white-space: nowrap;\n}\n@keyframes hb-kc1-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }\n@container (min-width: 760px) {\n  .hb-kc1-inner { padding: 104px 32px 88px; }\n  .hb-kc1-head { flex-direction: row; align-items: flex-end; justify-content: space-between; }\n  .hb-kc1-controls { flex-direction: column; align-items: flex-end; gap: 10px; }\n  .hb-kc1-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 64px; }\n  .hb-kc1-tier { padding: 34px 30px; }\n  .hb-kc1-tier + .hb-kc1-tier { border-top: 0; border-left: 1px solid rgba(255, 255, 255, .08); }\n  .hb-kc1-tier[data-featured=\"true\"] { margin: -16px 0; padding: 1px; border-left: 0; }\n  .hb-kc1-tier[data-featured=\"true\"] + .hb-kc1-tier { border-left: 0; }\n  .hb-kc1-tier[data-featured=\"true\"] .hb-kc1-body { padding: 49px 29px 33px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-kc1-tier[data-featured=\"true\"]::before { animation: none; }\n  .hb-kc1-pill, .hb-kc1-reel, .hb-kc1-slot, .hb-kc1-save, .hb-kc1-cta, .hb-kc1-cta svg { transition: none; }\n}\n`;\n\nfunction Check() {\n  return (\n    <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n      <path d=\"M3.5 8.5l3 3 6-7\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\nfunction Arrow() {\n  return (\n    <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n      <path d=\"M3 8h9.5M8.5 4l4 4-4 4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\nfunction Odometer({ value, width }: { value: number; width: number }) {\n  const chars = String(Math.max(0, Math.round(value))).padStart(width, \" \").split(\"\");\n  return (\n    <span className=\"hb-kc1-odo\" aria-hidden=\"true\">\n      {chars.map((c, i) => {\n        const digit = c === \" \" ? 0 : Number(c);\n        return (\n          <span key={i} className=\"hb-kc1-slot\" data-empty={c === \" \" ? \"true\" : \"false\"}>\n            <span\n              className=\"hb-kc1-reel\"\n              style={{ transform: `translateY(${(-digit * 10).toFixed(2)}%)`, \"--hb-kc1-d\": `${i * 70}ms` } as React.CSSProperties}\n            >\n              {\"0123456789\".split(\"\").map((n) => (\n                <span key={n}>{n}</span>\n              ))}\n            </span>\n          </span>\n        );\n      })}\n    </span>\n  );\n}\n\nexport function PricingSwitch({\n  eyebrow = \"Pricing\",\n  title = \"Pay for what you ship, not for seats\",\n  subtitle = \"Every plan includes global edge hosting, automatic HTTPS and instant rollbacks. Switch or cancel any time.\",\n  tiers = defaultTiers,\n  currency = \"$\",\n  period,\n  defaultPeriod = \"yearly\",\n  onPeriodChange,\n  saveLabel = \"Save 20%\",\n  footnote = \"Prices in USD, billed per workspace. Taxes calculated at checkout.\",\n  accent = \"#8b5cf6\",\n  className = \"\",\n  style,\n  ...rest\n}: PricingSwitchProps) {\n  const [inner, setInner] = React.useState<PricingSwitchPeriod>(defaultPeriod);\n  const current = period ?? inner;\n  const monthlyRef = React.useRef<HTMLButtonElement>(null);\n  const yearlyRef = React.useRef<HTMLButtonElement>(null);\n\n  const choose = (next: PricingSwitchPeriod) => {\n    if (next === current) return;\n    if (period === undefined) setInner(next);\n    onPeriodChange?.(next);\n  };\n\n  const onKey = (e: React.KeyboardEvent) => {\n    if (![\"ArrowLeft\", \"ArrowRight\", \"ArrowUp\", \"ArrowDown\"].includes(e.key)) return;\n    e.preventDefault();\n    const next = current === \"monthly\" ? \"yearly\" : \"monthly\";\n    choose(next);\n    (next === \"monthly\" ? monthlyRef : yearlyRef).current?.focus();\n  };\n\n  const vars = { \"--hb-kc1-accent\": accent, ...style } as React.CSSProperties;\n\n  return (\n    <section className={`hb-kc1 ${className}`} style={vars} {...rest}>\n      <style href=\"hb-pricing-switch\" precedence=\"default\">{css}</style>\n      <div className=\"hb-kc1-inner\">\n        <div className=\"hb-kc1-head\">\n          <div>\n            {eyebrow ? <p className=\"hb-kc1-eyebrow\">{eyebrow}</p> : null}\n            <h2 className=\"hb-kc1-title\">{title}</h2>\n            {subtitle ? <p className=\"hb-kc1-sub\">{subtitle}</p> : null}\n          </div>\n          <div className=\"hb-kc1-controls\">\n            <div className=\"hb-kc1-switch\" role=\"radiogroup\" aria-label=\"Billing period\" data-period={current} onKeyDown={onKey}>\n              <span className=\"hb-kc1-pill\" aria-hidden=\"true\" />\n              <button\n                ref={monthlyRef}\n                type=\"button\"\n                role=\"radio\"\n                className=\"hb-kc1-opt\"\n                aria-checked={current === \"monthly\"}\n                tabIndex={current === \"monthly\" ? 0 : -1}\n                onClick={() => choose(\"monthly\")}\n              >\n                Monthly\n              </button>\n              <button\n                ref={yearlyRef}\n                type=\"button\"\n                role=\"radio\"\n                className=\"hb-kc1-opt\"\n                aria-checked={current === \"yearly\"}\n                tabIndex={current === \"yearly\" ? 0 : -1}\n                onClick={() => choose(\"yearly\")}\n              >\n                Yearly\n              </button>\n            </div>\n            {saveLabel ? (\n              <span className=\"hb-kc1-save\" data-on={current === \"yearly\" ? \"true\" : \"false\"}>\n                <svg viewBox=\"0 0 12 12\" aria-hidden=\"true\">\n                  <path d=\"M6 1l1.4 3.1L10.8 4.5 8.3 6.8 9 10.2 6 8.5 3 10.2l.7-3.4L1.2 4.5l3.4-.4z\" fill=\"currentColor\" />\n                </svg>\n                {saveLabel} with yearly\n              </span>\n            ) : null}\n          </div>\n        </div>\n        <ul className=\"hb-kc1-panel\">\n          {tiers.map((tier) => {\n            const price = current === \"yearly\" ? tier.yearly : tier.monthly;\n            const width = Math.max(String(tier.monthly).length, String(tier.yearly).length);\n            const bill =\n              price === 0\n                ? \"Free forever, no card needed\"\n                : current === \"yearly\"\n                  ? `Billed ${currency}${tier.yearly * 12} once a year`\n                  : \"Billed monthly, cancel any time\";\n            return (\n              <li key={tier.name} className=\"hb-kc1-tier\" data-featured={tier.featured ? \"true\" : \"false\"}>\n                <div className=\"hb-kc1-body\">\n                  <div className=\"hb-kc1-row\">\n                    <h3 className=\"hb-kc1-name\">{tier.name}</h3>\n                    {tier.badge ? <span className=\"hb-kc1-badge\">{tier.badge}</span> : null}\n                  </div>\n                  <p className=\"hb-kc1-desc\">{tier.description}</p>\n                  <div className=\"hb-kc1-price\">\n                    <span className=\"hb-kc1-amount\">\n                      <span className=\"hb-kc1-cur\">{currency}</span>\n                      <Odometer value={price} width={width} />\n                    </span>\n                    <span className=\"hb-kc1-per\">/ month</span>\n                    <span className=\"hb-kc1-sr\" aria-live=\"polite\">\n                      {`${currency}${price} per month`}\n                    </span>\n                  </div>\n                  <p className=\"hb-kc1-bill\">{bill}</p>\n                  <a className=\"hb-kc1-cta\" href={tier.cta.href}>\n                    {tier.cta.label}\n                    <Arrow />\n                  </a>\n                  <ul className=\"hb-kc1-list\">\n                    {tier.features.map((f) => (\n                      <li key={f}>\n                        <Check />\n                        {f}\n                      </li>\n                    ))}\n                  </ul>\n                </div>\n              </li>\n            );\n          })}\n        </ul>\n        {footnote ? <p className=\"hb-kc1-foot\">{footnote}</p> : null}\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}