{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "odometer-pricing-demo",
  "type": "registry:block",
  "title": "Odometer: Pricing",
  "description": "Animated Number Counter example, Pricing: Monthly and yearly plans. Prices roll down to the yearly rate and back up, the yearly total rolls down from a year of monthly bills, and Starter's $0 never moves. A take on the number counter (count up). Fits stats, pricing, hero and app UI sections.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "stats",
    "pricing",
    "hero",
    "app-ui",
    "number-counter",
    "number",
    "data",
    "motion"
  ],
  "docs": "Live preview, examples and props: https://keyframeui.com/components/odometer#odometer-pricing-demo",
  "registryDependencies": [
    "https://keyframeui.com/r/odometer.json"
  ],
  "files": [
    {
      "path": "components/odometer-pricing-demo.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion } from \"motion/react\";\n\nimport { Odometer } from \"@/components/ui/odometer\";\n\nconst usd: Intl.NumberFormatOptions = { style: \"currency\", currency: \"USD\", maximumFractionDigits: 0 };\n\nconst plans = [\n  {\n    name: \"Starter\",\n    blurb: \"For side projects and trying things out.\",\n    monthly: 0,\n    yearly: 0,\n    features: [\"3 projects\", \"Community support\", \"7-day history\"],\n    cta: \"Start for free\",\n    featured: false,\n  },\n  {\n    name: \"Pro\",\n    blurb: \"For teams shipping every week.\",\n    monthly: 24,\n    yearly: 19,\n    features: [\"Unlimited projects\", \"Priority support\", \"1-year history\"],\n    cta: \"Start a trial\",\n    featured: true,\n  },\n  {\n    name: \"Team\",\n    blurb: \"For companies that need control.\",\n    monthly: 59,\n    yearly: 47,\n    features: [\"SSO and audit logs\", \"Custom roles\", \"Unlimited history\"],\n    cta: \"Talk to sales\",\n    featured: false,\n  },\n];\n\nconst periods = [\"Monthly\", \"Yearly\"] as const;\n\n// The prices roll down to the yearly rate and back up. Starter's $0 never\n// moves: only digits that change turn.\nexport function OdometerPricingDemo() {\n  const [yearly, setYearly] = React.useState(false);\n\n  return (\n    <div className=\"@container w-full max-w-4xl\">\n      <div className=\"flex justify-center\">\n        <div className=\"relative\">\n          <div\n            role=\"radiogroup\"\n            aria-label=\"Billing period\"\n            className=\"relative grid grid-cols-2 rounded-full border border-zinc-200 bg-zinc-100 p-1 dark:border-zinc-800 dark:bg-zinc-900\"\n          >\n            <motion.span\n              aria-hidden\n              className=\"absolute inset-y-1 left-1 w-[calc(50%-0.25rem)] rounded-full bg-white shadow-sm ring-1 shadow-zinc-950/10 ring-zinc-950/5 dark:bg-zinc-700 dark:ring-white/10\"\n              initial={false}\n              animate={{ x: yearly ? \"100%\" : \"0%\" }}\n              transition={{ type: \"spring\", stiffness: 520, damping: 42 }}\n            />\n            {periods.map((period) => {\n              const active = (period === \"Yearly\") === yearly;\n              return (\n                <button\n                  key={period}\n                  type=\"button\"\n                  role=\"radio\"\n                  aria-checked={active}\n                  onClick={() => setYearly(period === \"Yearly\")}\n                  className={`relative min-w-24 rounded-full px-4 py-1.5 text-sm font-medium transition-colors duration-200 outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 ${\n                    active\n                      ? \"text-zinc-950 dark:text-zinc-50\"\n                      : \"text-zinc-500 hover:text-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-200\"\n                  }`}\n                >\n                  {period}\n                </button>\n              );\n            })}\n          </div>\n          <div className=\"absolute top-1/2 left-full ml-3 -translate-y-1/2\">\n            <AnimatePresence initial={false}>\n              {yearly ? (\n                <motion.span\n                  initial={{ opacity: 0, x: -8, scale: 0.9 }}\n                  animate={{ opacity: 1, x: 0, scale: 1 }}\n                  exit={{ opacity: 0, x: -4, scale: 0.95, transition: { duration: 0.15 } }}\n                  transition={{ type: \"spring\", stiffness: 420, damping: 26 }}\n                  className=\"block rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-medium whitespace-nowrap text-emerald-700 ring-1 ring-emerald-600/20 ring-inset dark:text-emerald-400 dark:ring-emerald-400/20\"\n                >\n                  Save 20%\n                </motion.span>\n              ) : null}\n            </AnimatePresence>\n          </div>\n        </div>\n      </div>\n\n      <div className=\"mt-8 grid gap-4 @2xl:grid-cols-3\">\n        {plans.map((plan) => (\n          <div\n            key={plan.name}\n            className={\n              plan.featured\n                ? \"flex flex-col rounded-2xl bg-zinc-950 p-6 text-zinc-50 shadow-xl shadow-zinc-950/20 dark:bg-zinc-50 dark:text-zinc-950 dark:shadow-black/40\"\n                : \"flex flex-col rounded-2xl border border-zinc-200 bg-white p-6 text-zinc-950 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-50\"\n            }\n          >\n            <div className=\"flex items-center justify-between\">\n              <p className=\"font-mono text-xs tracking-widest uppercase opacity-60\">{plan.name}</p>\n              {plan.featured ? (\n                <span className=\"rounded-full bg-white/10 px-2 py-0.5 text-[11px] font-medium dark:bg-zinc-950/10\">\n                  Popular\n                </span>\n              ) : null}\n            </div>\n\n            <p className=\"mt-5 flex items-baseline gap-1.5\">\n              <Odometer\n                value={yearly ? plan.yearly : plan.monthly}\n                format={usd}\n                className=\"text-5xl leading-none font-semibold tracking-[-0.04em]\"\n              />\n              <span className=\"text-sm opacity-60\">/ month</span>\n            </p>\n\n            {/* Both lines share one cell, so switching never moves the card. */}\n            <p className=\"mt-2 grid text-sm opacity-60\">\n              {plan.monthly === 0 ? (\n                <span>Free forever</span>\n              ) : (\n                <>\n                  <motion.span\n                    aria-hidden={yearly}\n                    className=\"[grid-area:1/1]\"\n                    initial={false}\n                    animate={{ opacity: yearly ? 0 : 1, y: yearly ? -6 : 0 }}\n                    transition={{ duration: 0.25, ease: [0.22, 1, 0.36, 1] }}\n                  >\n                    billed monthly\n                  </motion.span>\n                  <motion.span\n                    aria-hidden={!yearly}\n                    className=\"[grid-area:1/1]\"\n                    initial={false}\n                    animate={{ opacity: yearly ? 1 : 0, y: yearly ? 0 : 6 }}\n                    transition={{ duration: 0.25, ease: [0.22, 1, 0.36, 1] }}\n                  >\n                    {/* Rolls down from a year of monthly bills as it appears. */}\n                    billed <Odometer value={(yearly ? plan.yearly : plan.monthly) * 12} format={usd} /> yearly\n                  </motion.span>\n                </>\n              )}\n            </p>\n\n            <p className=\"mt-5 text-sm opacity-75\">{plan.blurb}</p>\n            <ul className=\"mt-5 space-y-2.5 border-t border-current/10 pt-5 text-sm\">\n              {plan.features.map((feature) => (\n                <li key={feature} className=\"flex items-center gap-2.5\">\n                  <svg\n                    aria-hidden\n                    viewBox=\"0 0 16 16\"\n                    fill=\"none\"\n                    stroke=\"currentColor\"\n                    strokeWidth=\"1.75\"\n                    strokeLinecap=\"round\"\n                    strokeLinejoin=\"round\"\n                    className=\"size-3.5 opacity-50\"\n                  >\n                    <path d=\"M3 8.5 6.5 12 13 4.5\" />\n                  </svg>\n                  {feature}\n                </li>\n              ))}\n            </ul>\n            <button\n              type=\"button\"\n              className={\n                plan.featured\n                  ? \"mt-7 h-10 rounded-xl bg-white text-sm font-medium text-zinc-950 transition-[background-color,scale] duration-150 hover:bg-zinc-200 active:scale-[0.97] dark:bg-zinc-950 dark:text-zinc-50 dark:hover:bg-zinc-800\"\n                  : \"mt-7 h-10 rounded-xl border border-zinc-200 text-sm font-medium transition-[background-color,scale] duration-150 hover:bg-zinc-100 active:scale-[0.97] dark:border-zinc-700 dark:hover:bg-zinc-800\"\n              }\n            >\n              {plan.cta}\n            </button>\n          </div>\n        ))}\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}