{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "jot-pricing",
  "type": "registry:block",
  "title": "Jot Pricing",
  "description": "Pricing Section built with Jot (hand-drawn annotation arrow) and Odometer (animated number counter): handwritten notes point at the right plan. A take on the annotation (arrow) and number counter (count up). A pricing section where the handwritten notes do the selling. A note beside the billing switch points at Yearly and rewrites itself to a thank-you when the visitor switches, while every price rolls to its new number. Drag the device slider and the note above the plans swings its arrow to the one that fits.",
  "author": "KeyframeUI <https://keyframeui.com>",
  "categories": [
    "blocks",
    "pricing-sections",
    "pricing",
    "annotation",
    "number-counter"
  ],
  "docs": "Live preview and the components it's built with: https://keyframeui.com/blocks/pricing-sections/jot-pricing",
  "registryDependencies": [
    "https://keyframeui.com/r/jot.json",
    "https://keyframeui.com/r/odometer.json"
  ],
  "files": [
    {
      "path": "components/jot-pricing.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { Jot } from \"@/components/ui/jot\";\nimport { Odometer } from \"@/components/ui/odometer\";\n\n/* ── Content ─────────────────────────────────────────────────\n * Everything you'd change to make the section yours: the copy,\n * the plans and their limits, and the handwritten notes. The\n * device slider picks the plan that fits, and the note above\n * the cards points at it.\n * ─────────────────────────────────────────────────────────── */\n\n/** The one accent: the fitting plan's ring, its button and the slider. */\nconst ACCENT = { light: \"#0f766e\", dark: \"#2dd4bf\" };\n\nconst EYEBROW = \"Pricing\";\nconst HEADLINE = \"Pay for the devices you sync.\";\nconst HEADLINE_QUIET = \"Not the seats.\";\nconst SUBLINE =\n  \"Every plan syncs offline, merges without conflicts and keeps 30 days of history. Start free and move up when your app takes off.\";\n\nconst SLIDER_LABEL = \"Devices syncing each month\";\nconst DEVICES = { min: 100, max: 250_000, start: 12_000 };\n\n/** The notes in the margin. The billing note rewrites itself when the visitor switches. */\nconst NOTES = {\n  monthly: \"2 months free if you go yearly\",\n  yearly: \"nice, 2 months on us\",\n  fit: { hobby: \"free covers this\", pro: \"this one fits\", scale: \"you'll want this one\" },\n};\n\ntype PlanId = keyof typeof NOTES.fit;\n\ntype Plan = {\n  id: PlanId;\n  name: string;\n  blurb: string;\n  /** USD per month, billed monthly and billed yearly. */\n  monthly: number;\n  yearly: number;\n  /** The most devices it syncs; the slider picks the first plan that covers the count. */\n  devices: number;\n  cta: { label: string; href: string };\n  features: string[];\n};\n\nconst PLANS: Plan[] = [\n  {\n    id: \"hobby\",\n    name: \"Hobby\",\n    blurb: \"For side projects and prototypes.\",\n    monthly: 0,\n    yearly: 0,\n    devices: 1_000,\n    cta: { label: \"Start free\", href: \"#start\" },\n    features: [\"Offline writes and merges\", \"7 days of history\", \"Community support\"],\n  },\n  {\n    id: \"pro\",\n    name: \"Pro\",\n    blurb: \"For apps with real people in them.\",\n    monthly: 29,\n    yearly: 24,\n    devices: 25_000,\n    cta: { label: \"Start a 14-day trial\", href: \"#trial\" },\n    features: [\"Everything in Hobby\", \"30 days of history\", \"Presence and live cursors\", \"Email support, next business day\"],\n  },\n  {\n    id: \"scale\",\n    name: \"Scale\",\n    blurb: \"For apps people never close.\",\n    monthly: 199,\n    yearly: 166,\n    devices: 250_000,\n    cta: { label: \"Talk to us\", href: \"#sales\" },\n    features: [\"Everything in Pro\", \"1 year of history\", \"Your own region\", \"A shared Slack channel\"],\n  },\n];\n\nconst usd: Intl.NumberFormatOptions = { style: \"currency\", currency: \"USD\", maximumFractionDigits: 0 };\nconst count = new Intl.NumberFormat(\"en-US\");\n\n// The slider moves on a log scale, so 100 and 250,000 devices are both a short drag away.\nconst STEPS = 1000;\nconst span = Math.log10(DEVICES.max / DEVICES.min);\nconst toDevices = (step: number) => {\n  const raw = DEVICES.min * 10 ** ((step / STEPS) * span);\n  const magnitude = 10 ** Math.max(0, Math.floor(Math.log10(raw)) - 1);\n  return Math.round(raw / magnitude) * magnitude;\n};\nconst toStep = (devices: number) => Math.round((Math.log10(devices / DEVICES.min) / span) * STEPS);\n\n/* ── Section ─────────────────────────────────────────────── */\n\nexport function JotPricing() {\n  const [yearly, setYearly] = React.useState(false);\n  const [step, setStep] = React.useState(() => toStep(DEVICES.start));\n  const devices = toDevices(step);\n  const fit = (PLANS.find((plan) => devices <= plan.devices) ?? PLANS[PLANS.length - 1]).id;\n\n  const yearlyRef = React.useRef<HTMLButtonElement>(null);\n  const cards = {\n    hobby: React.useRef<HTMLDivElement>(null),\n    pro: React.useRef<HTMLDivElement>(null),\n    scale: React.useRef<HTMLDivElement>(null),\n  };\n\n  return (\n    <section\n      data-jot-scope\n      style={\n        {\n          \"--accent-light\": ACCENT.light,\n          \"--accent-dark\": ACCENT.dark,\n        } as React.CSSProperties\n      }\n      className=\"bg-white text-zinc-950 [--accent:var(--accent-light)] dark:bg-zinc-950 dark:text-white dark:[--accent:var(--accent-dark)]\"\n    >\n      <div className=\"mx-auto max-w-5xl px-6 py-24 sm:py-32\">\n        <div className=\"mx-auto max-w-2xl text-center\">\n          <p className=\"text-sm font-semibold text-(--accent)\">{EYEBROW}</p>\n          <h2 className=\"mt-3 text-4xl font-semibold tracking-[-0.03em] text-balance sm:text-5xl\">\n            {HEADLINE} <span className=\"text-zinc-400 dark:text-zinc-500\">{HEADLINE_QUIET}</span>\n          </h2>\n          <p className=\"mx-auto mt-5 max-w-xl text-base leading-relaxed text-pretty text-zinc-600 dark:text-zinc-400\">\n            {SUBLINE}\n          </p>\n        </div>\n\n        {/* Billing, with a note that talks the visitor into yearly and thanks them when they switch. */}\n        <div className=\"mt-12 flex justify-center\">\n          <div className=\"relative\">\n            <div\n              role=\"radiogroup\"\n              aria-label=\"Billing\"\n              className=\"inline-flex rounded-full bg-zinc-100 p-1 text-sm font-medium dark:bg-white/[0.07]\"\n            >\n              {[false, true].map((option) => (\n                <button\n                  key={String(option)}\n                  ref={option ? yearlyRef : undefined}\n                  type=\"button\"\n                  role=\"radio\"\n                  aria-checked={yearly === option}\n                  onClick={() => setYearly(option)}\n                  className={`rounded-full px-4 py-1.5 transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--accent) ${\n                    yearly === option\n                      ? \"bg-white text-zinc-950 shadow-sm dark:bg-zinc-800 dark:text-white\"\n                      : \"text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white\"\n                  }`}\n                >\n                  {option ? \"Yearly\" : \"Monthly\"}\n                </button>\n              ))}\n            </div>\n            <Jot\n              to={yearlyRef}\n              from=\"left\"\n              bend={-0.45}\n              tilt={-2}\n              className=\"absolute top-1/2 left-full mt-3 ml-8 hidden w-max whitespace-nowrap text-zinc-600 sm:block dark:text-zinc-300\"\n            >\n              {yearly ? NOTES.yearly : NOTES.monthly}\n            </Jot>\n          </div>\n        </div>\n\n        {/* How many devices: the plan that covers them gets the ring and the note. */}\n        <div className=\"mx-auto mt-10 max-w-md\">\n          <div className=\"flex items-baseline justify-between text-sm\">\n            <label htmlFor=\"jot-pricing-devices\" className=\"font-medium\">\n              {SLIDER_LABEL}\n            </label>\n            <span className=\"font-semibold tabular-nums\">{count.format(devices)}</span>\n          </div>\n          <input\n            id=\"jot-pricing-devices\"\n            type=\"range\"\n            min={0}\n            max={STEPS}\n            value={step}\n            onChange={(event) => setStep(Number(event.target.value))}\n            aria-valuetext={`${count.format(devices)} devices`}\n            className=\"mt-3 w-full cursor-pointer accent-(--accent)\"\n          />\n        </div>\n\n        <div className=\"relative mt-24 grid gap-4 md:mt-28 md:grid-cols-3\">\n          <Jot\n            to={cards[fit]}\n            at=\"top\"\n            bend={0.3}\n            tilt={-1.5}\n            className=\"absolute -top-16 left-1/2 hidden w-max -translate-x-1/2 text-zinc-600 md:block dark:text-zinc-300\"\n          >\n            {NOTES.fit[fit]}\n          </Jot>\n\n          {PLANS.map((plan) => {\n            const fits = plan.id === fit;\n            const price = yearly ? plan.yearly : plan.monthly;\n            return (\n              <div\n                key={plan.id}\n                ref={cards[plan.id]}\n                className={`relative flex flex-col rounded-2xl p-7 transition-[box-shadow,background-color] duration-300 motion-reduce:transition-none ${\n                  fits\n                    ? \"bg-(--accent)/[0.04] shadow-[0_0_0_2px_var(--accent),0_12px_32px_-16px_rgb(0_0_0/0.25)]\"\n                    : \"shadow-[0_0_0_1px_rgb(9_9_11/0.08)] dark:shadow-[0_0_0_1px_rgb(255_255_255/0.1)]\"\n                }`}\n              >\n                <h3 className=\"text-base font-semibold\">{plan.name}</h3>\n                <p className=\"mt-1 text-sm text-zinc-500 dark:text-zinc-400\">{plan.blurb}</p>\n                <p className=\"mt-6 flex items-baseline gap-1\">\n                  <Odometer value={price} format={usd} className=\"text-4xl font-semibold tracking-[-0.03em]\" />\n                  <span className=\"text-sm text-zinc-500 dark:text-zinc-400\">/mo</span>\n                </p>\n                <p className=\"mt-1 h-5 text-xs text-zinc-500 dark:text-zinc-400\">\n                  {price === 0 ? \"Free forever\" : yearly ? `Billed $${count.format(price * 12)} a year` : \"Billed monthly\"}\n                </p>\n                <a\n                  href={plan.cta.href}\n                  className={`mt-6 rounded-full px-4 py-2.5 text-center text-sm font-semibold transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--accent) ${\n                    fits\n                      ? \"bg-(--accent) text-white hover:opacity-90 dark:text-zinc-950\"\n                      : \"bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-white/[0.08] dark:text-white dark:hover:bg-white/[0.12]\"\n                  }`}\n                >\n                  {plan.cta.label}\n                </a>\n                <p className=\"mt-6 text-sm font-medium\">Up to {count.format(plan.devices)} devices</p>\n                <ul className=\"mt-3 space-y-2.5 text-sm text-zinc-600 dark:text-zinc-400\">\n                  {plan.features.map((feature) => (\n                    <li key={feature} className=\"flex gap-2.5\">\n                      <CheckIcon className=\"mt-0.5 size-4 shrink-0 text-(--accent)\" />\n                      {feature}\n                    </li>\n                  ))}\n                </ul>\n              </div>\n            );\n          })}\n        </div>\n      </div>\n    </section>\n  );\n}\n\nfunction CheckIcon({ className }: { className?: string }) {\n  return (\n    <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth={1.8} className={className} aria-hidden>\n      <path d=\"m3.5 8.5 3 3 6-7\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n"
    }
  ]
}