{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-block",
  "type": "registry:block",
  "title": "Pricing Block",
  "description": "A Pricing Block component for displaying pricing plans.",
  "files": [
    {
      "path": "src/registry/blocks/pricing-block.tsx",
      "type": "registry:block",
      "content": "\"use client\";\n\nimport { useId, useRef, useState, type ComponentProps, type CSSProperties, type KeyboardEvent } from \"react\";\nimport { Check } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type BillingCycle = \"monthly\" | \"yearly\";\n\nexport type PricingPlan = {\n  name: string;\n  /** One line on who the plan is for. */\n  description?: string;\n  /** Display prices per cycle, e.g. { monthly: \"$18\", yearly: \"$15\" }. */\n  price: Record<BillingCycle, string>;\n  /** Text after the price per cycle. Defaults to \"per month\" and \"per month, billed yearly\". */\n  period?: Partial<Record<BillingCycle, string>>;\n  features: string[];\n  cta: { label: string; href: string };\n  /** Marks the recommended plan with the accent colour. */\n  highlighted?: boolean;\n  /** Short label on the highlighted plan, e.g. \"Most studios pick this\". */\n  badge?: string;\n};\n\nexport type PricingBlockProps = {\n  eyebrow?: string;\n  title?: string;\n  description?: string;\n  plans?: PricingPlan[];\n  defaultBilling?: BillingCycle;\n  /** Shown next to the yearly option, e.g. \"2 months free\". */\n  yearlyNote?: string;\n  footnote?: string;\n  /** Any CSS color for the highlighted plan and the active toggle. */\n  accent?: string;\n  /** Text color on the accent. */\n  accentForeground?: string;\n} & Omit<ComponentProps<\"section\">, \"title\">;\n\nconst DEFAULT_PLANS: PricingPlan[] = [\n  {\n    name: \"Solo\",\n    description: \"For one person sending a handful of invoices a month.\",\n    price: { monthly: \"$0\", yearly: \"$0\" },\n    period: { monthly: \"free for good\", yearly: \"free for good\" },\n    features: [\"5 invoices a month\", \"Card and bank payments\", \"Automatic reminders on day 7 and 14\"],\n    cta: { label: \"Start invoicing free\", href: \"#\" },\n  },\n  {\n    name: \"Studio\",\n    description: \"For small teams that bill by the project or the hour.\",\n    price: { monthly: \"$18\", yearly: \"$15\" },\n    features: [\n      \"Unlimited invoices and quotes\",\n      \"Time tracking that turns into line items\",\n      \"Up to 5 teammates\",\n      \"Exports for Xero and QuickBooks\",\n    ],\n    cta: { label: \"Try Studio for 14 days\", href: \"#\" },\n    highlighted: true,\n    badge: \"Most studios pick this\",\n  },\n  {\n    name: \"Agency\",\n    description: \"For agencies with several clients and approval steps.\",\n    price: { monthly: \"$42\", yearly: \"$35\" },\n    features: [\"Everything in Studio\", \"Unlimited teammates\", \"Client approval before sending\", \"Priority support, replies within 4 hours\"],\n    cta: { label: \"Talk to us about Agency\", href: \"#\" },\n  },\n];\n\nconst DEFAULTS = {\n  eyebrow: \"(Pricing)\",\n  title: \"Pay for the invoices you send, not the seats you might need.\",\n  description: \"Every plan includes card and bank payments at the processor's rate. We don't add a percentage on top.\",\n  yearlyNote: \"2 months free\",\n  footnote: \"Prices in USD, excluding tax. Cancel any time; your invoices stay exportable.\",\n};\n\nconst CYCLES: { value: BillingCycle; label: string }[] = [\n  { value: \"monthly\", label: \"Monthly\" },\n  { value: \"yearly\", label: \"Yearly\" },\n];\n\n/**\n * Pricing section: a heading, a monthly/yearly toggle and plan columns separated by hairlines.\n * The highlighted plan carries the accent; every plan's call to action is a link.\n */\nexport default function PricingBlock({\n  eyebrow = DEFAULTS.eyebrow,\n  title = DEFAULTS.title,\n  description = DEFAULTS.description,\n  plans = DEFAULT_PLANS,\n  defaultBilling = \"yearly\",\n  yearlyNote = DEFAULTS.yearlyNote,\n  footnote = DEFAULTS.footnote,\n  accent = \"#0A6EFF\",\n  accentForeground = \"#FFFFFF\",\n  className,\n  style,\n  ...props\n}: PricingBlockProps) {\n  const headingId = useId();\n  const [billing, setBilling] = useState<BillingCycle>(defaultBilling);\n  const optionRefs = useRef<(HTMLButtonElement | null)[]>([]);\n\n  // Radio-group keyboard pattern: arrow keys move the selection and the focus together.\n  const onKeyDown = (event: KeyboardEvent<HTMLButtonElement>, index: number) => {\n    if (![\"ArrowLeft\", \"ArrowRight\", \"ArrowUp\", \"ArrowDown\"].includes(event.key)) return;\n    event.preventDefault();\n    const next = (index + (event.key === \"ArrowLeft\" || event.key === \"ArrowUp\" ? -1 : 1) + CYCLES.length) % CYCLES.length;\n    setBilling(CYCLES[next].value);\n    optionRefs.current[next]?.focus();\n  };\n\n  return (\n    <section\n      data-slot=\"pricing-block\"\n      aria-labelledby={headingId}\n      style={{ \"--block-accent\": accent, \"--block-accent-fg\": accentForeground, ...style } as CSSProperties}\n      className={cn(\"w-full bg-background text-foreground\", className)}\n      {...props}\n    >\n      <div className=\"mx-auto max-w-6xl px-6 py-20 md:py-28\">\n        <div className=\"grid gap-6 md:grid-cols-12 md:gap-10\">\n          <p className=\"font-mono text-xs uppercase tracking-wider text-muted-foreground md:col-span-4\">{eyebrow}</p>\n          <div className=\"md:col-span-8\">\n            <h2 id={headingId} className=\"text-3xl font-semibold tracking-[-0.03em] text-balance sm:text-4xl md:text-5xl\">\n              {title}\n            </h2>\n            <p className=\"mt-5 max-w-xl text-base leading-relaxed text-muted-foreground\">{description}</p>\n\n            <div role=\"radiogroup\" aria-label=\"Billing period\" className=\"mt-8 inline-flex border\">\n              {CYCLES.map((cycle, index) => {\n                const checked = billing === cycle.value;\n                return (\n                  <button\n                    key={cycle.value}\n                    ref={(node) => {\n                      optionRefs.current[index] = node;\n                    }}\n                    type=\"button\"\n                    role=\"radio\"\n                    aria-checked={checked}\n                    tabIndex={checked ? 0 : -1}\n                    onClick={() => setBilling(cycle.value)}\n                    onKeyDown={(event) => onKeyDown(event, index)}\n                    className={cn(\n                      \"min-h-11 cursor-pointer px-4 font-mono text-xs uppercase tracking-wider transition-colors outline-none focus-visible:ring-2 focus-visible:ring-[var(--block-accent)] focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n                      checked ? \"bg-foreground text-background\" : \"text-muted-foreground hover:text-foreground\"\n                    )}\n                  >\n                    {cycle.label}\n                    {cycle.value === \"yearly\" && yearlyNote && (\n                      <span className={cn(\"ml-2 normal-case tracking-normal\", checked ? \"text-background/70\" : \"text-[var(--block-accent)]\")}>\n                        {yearlyNote}\n                      </span>\n                    )}\n                  </button>\n                );\n              })}\n            </div>\n          </div>\n        </div>\n\n        <ul className={cn(\"mt-16 grid border-t\", plans.length >= 3 ? \"lg:grid-cols-3\" : \"md:grid-cols-2\")}>\n          {plans.map((plan, i) => {\n            const period = plan.period?.[billing] ?? (billing === \"yearly\" ? \"per month, billed yearly\" : \"per month\");\n            return (\n              <li\n                key={plan.name}\n                className={cn(\n                  \"relative flex flex-col border-b py-10 lg:border-b-0 lg:px-8 lg:first:pl-0 lg:last:pr-0\",\n                  i > 0 && \"lg:border-l\"\n                )}\n              >\n                {plan.highlighted && (\n                  <span aria-hidden className=\"absolute -top-px right-0 left-0 h-0.5 bg-[var(--block-accent)] lg:left-8 lg:right-8\" />\n                )}\n                <div className=\"flex flex-wrap items-baseline justify-between gap-3\">\n                  <h3 className=\"text-lg font-medium tracking-[-0.01em]\">{plan.name}</h3>\n                  {plan.highlighted && plan.badge && (\n                    <span className=\"bg-[var(--block-accent)] px-2 py-1 font-mono text-[0.625rem] uppercase tracking-wider text-[var(--block-accent-fg)]\">\n                      {plan.badge}\n                    </span>\n                  )}\n                </div>\n                {plan.description && <p className=\"mt-2 max-w-[32ch] text-sm leading-relaxed text-muted-foreground\">{plan.description}</p>}\n\n                <p className=\"mt-8 flex items-baseline gap-2\">\n                  <span className=\"text-5xl font-semibold tracking-[-0.04em] tabular-nums\">{plan.price[billing]}</span>\n                  <span className=\"text-sm text-muted-foreground\">{period}</span>\n                </p>\n\n                <ul className=\"mt-8 mb-10 flex-1 space-y-3 text-sm\">\n                  {plan.features.map((feature) => (\n                    <li key={feature} className=\"flex gap-3\">\n                      <Check aria-hidden className=\"mt-0.5 size-4 shrink-0 text-[var(--block-accent)]\" strokeWidth={2} />\n                      <span>{feature}</span>\n                    </li>\n                  ))}\n                </ul>\n\n                <a\n                  href={plan.cta.href}\n                  className={cn(\n                    \"inline-flex min-h-11 items-center justify-center px-5 text-sm font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-[var(--block-accent)] focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n                    plan.highlighted\n                      ? \"bg-[var(--block-accent)] text-[var(--block-accent-fg)] hover:opacity-90\"\n                      : \"border hover:bg-muted\"\n                  )}\n                >\n                  {plan.cta.label}\n                </a>\n              </li>\n            );\n          })}\n        </ul>\n\n        {footnote && <p className=\"mt-10 border-t pt-4 text-xs leading-relaxed text-muted-foreground\">{footnote}</p>}\n      </div>\n    </section>\n  );\n}\n\nexport { PricingBlock };\n"
    }
  ],
  "dependencies": [
    "lucide-react"
  ]
}
