{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"ledger-pricing","type":"registry:block","title":"Ledger pricing","description":"A free Swiss architectural pricing section with three flush ruled columns, solid-ink inversion on the featured tier and a mechanical Monthly/Annual switch.","author":"Hairline UI","dependencies":["lucide-react"],"files":[{"path":"registry/ledger-pricing.tsx","type":"registry:component","content":"// Hairline UI · ledger-pricing · MIT License\n// Copyright (c) 2026 Hairline UI · https://hairlineui.com/license#components\n\n\"use client\";\n\nimport * as React from \"react\";\nimport { ArrowRight, Check } from \"lucide-react\";\n\n/* ─────────────────────────────────────────────────────────\n * LEDGER PRICING — Swiss architectural pricing ledger (free MIT)\n *\n *   layout    three flush ruled columns seated inside one\n *             continuous border frame; the featured tier uses\n *             full solid-ink inversion with an emerald top rule\n *   billing   crisp engraved Monthly / Annual rocker switch\n *             with inline numeric easing and async CTA states\n * ───────────────────────────────────────────────────────── */\n\nexport type LedgerBilling = \"monthly\" | \"annual\";\nexport type LedgerTone = \"day\" | \"night\";\n\nexport interface LedgerTier {\n  id: string;\n  name: string;\n  tagline: string;\n  monthlyPrice: number | null;\n  annualPrice?: number | null;\n  featured?: boolean;\n  ctaLabel: string;\n  features: string[];\n}\n\nexport interface LedgerPricingProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  heading?: string;\n  subheading?: string;\n  tone?: LedgerTone;\n  annualBadge?: string;\n  tiers?: LedgerTier[];\n  onSelectTier?: (payload: { tierId: string; billing: LedgerBilling; price: number | null }) => Promise<unknown> | void;\n}\n\nconst TONES: Record<LedgerTone, Record<string, string>> = {\n  day: {\n    \"--lp-bg\": \"#f5f4ef\",\n    \"--lp-sheet\": \"#ffffff\",\n    \"--lp-ink\": \"#121314\",\n    \"--lp-ink-2\": \"#484c52\",\n    \"--lp-ink-3\": \"#7a7e86\",\n    \"--lp-rule\": \"rgba(18, 19, 20, 0.14)\",\n    \"--lp-rule-strong\": \"#121314\",\n    \"--lp-invert-bg\": \"#121314\",\n    \"--lp-invert-ink\": \"#f5f4ef\",\n    \"--lp-invert-muted\": \"rgba(245, 244, 239, 0.68)\",\n    \"--lp-invert-rule\": \"rgba(245, 244, 239, 0.16)\",\n    \"--lp-signal\": \"#146c43\",\n    \"--lp-on-signal\": \"#ffffff\",\n  },\n  night: {\n    \"--lp-bg\": \"#0e0f12\",\n    \"--lp-sheet\": \"#15171c\",\n    \"--lp-ink\": \"#f3f2ed\",\n    \"--lp-ink-2\": \"#a3a7b0\",\n    \"--lp-ink-3\": \"#6c7079\",\n    \"--lp-rule\": \"rgba(243, 242, 237, 0.12)\",\n    \"--lp-rule-strong\": \"#f3f2ed\",\n    \"--lp-invert-bg\": \"#f3f2ed\",\n    \"--lp-invert-ink\": \"#0e0f12\",\n    \"--lp-invert-muted\": \"rgba(14, 15, 18, 0.68)\",\n    \"--lp-invert-rule\": \"rgba(14, 15, 18, 0.16)\",\n    \"--lp-signal\": \"#22a866\",\n    \"--lp-on-signal\": \"#0e0f12\",\n  },\n};\n\nconst DEFAULT_TIERS: LedgerTier[] = [\n  {\n    id: \"starter\",\n    name: \"Starter\",\n    tagline: \"Everything an independent builder needs to launch fast.\",\n    monthlyPrice: 24,\n    annualPrice: 19,\n    ctaLabel: \"Start Starter\",\n    features: [\n      \"Up to 3 production projects\",\n      \"100k monthly tracked requests\",\n      \"30-day searchable log history\",\n      \"Email support within 24 hours\",\n    ],\n  },\n  {\n    id: \"pro\",\n    name: \"Studio\",\n    tagline: \"Built for product teams shipping daily with shared reviews.\",\n    monthlyPrice: 79,\n    annualPrice: 63,\n    featured: true,\n    ctaLabel: \"Start Studio\",\n    features: [\n      \"Unlimited production projects\",\n      \"2M monthly tracked requests\",\n      \"12-month hot log & metric archive\",\n      \"Role-based access & Slack alerts\",\n      \"Priority engineering Slack channel\",\n    ],\n  },\n  {\n    id: \"enterprise\",\n    name: \"Enterprise\",\n    tagline: \"Custom residency, dedicated clusters and contractual uptime.\",\n    monthlyPrice: null,\n    annualPrice: null,\n    ctaLabel: \"Contact sales\",\n    features: [\n      \"Single-tenant regional deployment\",\n      \"SAML SSO & SCIM user sync\",\n      \"Custom retention & compliance DPA\",\n      \"99.99% uptime SLA & named engineer\",\n    ],\n  },\n];\n\nexport function LedgerPricing({\n  eyebrow = \"Pricing\",\n  heading = \"Straightforward plans, built to scale.\",\n  subheading = \"No surprise seat taxes or opaque add-ons. Switch between monthly and annual billing at any time.\",\n  tone = \"day\",\n  annualBadge = \"Save 20%\",\n  tiers = DEFAULT_TIERS,\n  onSelectTier,\n  className = \"\",\n  style,\n  ...rest\n}: LedgerPricingProps) {\n  const [billing, setBilling] = React.useState<LedgerBilling>(\"annual\");\n  const [busyId, setBusyId] = React.useState<string | null>(null);\n  const [selectedId, setSelectedId] = React.useState<string | null>(null);\n\n  const handleChoose = async (tier: LedgerTier, price: number | null) => {\n    setBusyId(tier.id);\n    try {\n      if (onSelectTier) {\n        await onSelectTier({ tierId: tier.id, billing, price });\n      } else {\n        await new Promise((r) => setTimeout(r, 320));\n      }\n      setSelectedId(tier.id);\n    } finally {\n      setBusyId(null);\n    }\n  };\n\n  const rootStyle = React.useMemo(() => ({ ...TONES[tone], ...style }) as React.CSSProperties, [tone, style]);\n\n  return (\n    <section\n      data-natural-width\n      style={rootStyle}\n      className={`@container relative w-full overflow-x-clip antialiased [font-family:var(--lp-text,inherit)] ${className}`}\n      {...rest}\n    >\n      <div className=\"w-full\" style={{ background: \"var(--lp-bg)\", color: \"var(--lp-ink)\" }}>\n        <div className=\"mx-auto w-full max-w-[1320px] px-4 py-10 @[40rem]:px-8 @[56rem]:px-12 @[56rem]:py-14\">\n          {/* Header Row */}\n          <div\n            className=\"mb-8 flex flex-col justify-between gap-6 pb-8 @[52rem]:flex-row @[52rem]:items-end\"\n            style={{ borderBottom: \"2px solid var(--lp-rule-strong)\" }}\n          >\n            <div className=\"max-w-xl\">\n              <p\n                className=\"mb-2.5 text-[11px] font-semibold tracking-[0.14em] uppercase\"\n                style={{ color: \"var(--lp-signal)\" }}\n              >\n                {eyebrow}\n              </p>\n              <h2\n                className=\"text-[30px] leading-[1.05] font-semibold tracking-[-0.035em] text-balance @[36rem]:text-[40px] @[56rem]:text-[48px]\"\n                style={{ fontFamily: \"var(--lp-display, inherit)\" }}\n              >\n                {heading}\n              </h2>\n              <p className=\"mt-3 text-[14.5px] leading-[1.58]\" style={{ color: \"var(--lp-ink-2)\" }}>\n                {subheading}\n              </p>\n            </div>\n\n            {/* Mechanical Billing Rocker */}\n            <div\n              role=\"radiogroup\"\n              aria-label=\"Billing period\"\n              className=\"inline-grid shrink-0 grid-cols-2 border p-[3px]\"\n              style={{ borderColor: \"var(--lp-rule-strong)\", background: \"var(--lp-sheet)\" }}\n            >\n              {(\n                [\n                  { id: \"monthly\" as const, label: \"Monthly\" },\n                  { id: \"annual\" as const, label: `Annual · ${annualBadge}` },\n                ] as const\n              ).map((opt) => {\n                const on = billing === opt.id;\n                return (\n                  <button\n                    key={opt.id}\n                    type=\"button\"\n                    role=\"radio\"\n                    aria-checked={on}\n                    onClick={() => setBilling(opt.id)}\n                    className=\"cursor-pointer px-4 py-2 text-[12px] font-semibold transition-colors focus-visible:outline-2 focus-visible:outline-offset-2\"\n                    style={{\n                      touchAction: \"manipulation\",\n                      background: on ? \"var(--lp-invert-bg)\" : \"transparent\",\n                      color: on ? \"var(--lp-invert-ink)\" : \"var(--lp-ink-2)\",\n                      outlineColor: \"var(--lp-signal)\",\n                    }}\n                  >\n                    {opt.label}\n                  </button>\n                );\n              })}\n            </div>\n          </div>\n\n          {/* Flush 3-Column Swiss Architectural Ledger (zero rounded cards) */}\n          <div\n            className=\"grid grid-cols-1 border @[52rem]:grid-cols-3\"\n            style={{ borderColor: \"var(--lp-rule-strong)\" }}\n          >\n            {tiers.map((tier, idx) => {\n              const inv = Boolean(tier.featured);\n              const price = billing === \"annual\" ? (tier.annualPrice ?? tier.monthlyPrice) : tier.monthlyPrice;\n              const isBusy = busyId === tier.id;\n              const isSelected = selectedId === tier.id;\n\n              return (\n                <article\n                  key={tier.id}\n                  className=\"relative flex flex-col justify-between p-6 @[40rem]:p-8\"\n                  style={{\n                    background: inv ? \"var(--lp-invert-bg)\" : \"var(--lp-sheet)\",\n                    color: inv ? \"var(--lp-invert-ink)\" : \"var(--lp-ink)\",\n                    borderTop: inv ? \"4px solid var(--lp-signal)\" : idx > 0 ? \"1px solid var(--lp-rule)\" : \"4px solid transparent\",\n                    borderLeft: idx > 0 ? undefined : undefined,\n                  }}\n                >\n                  {/* Desktop vertical rule */}\n                  {idx > 0 && (\n                    <span\n                      aria-hidden=\"true\"\n                      className=\"pointer-events-none absolute inset-y-0 left-0 hidden w-px @[52rem]:block\"\n                      style={{ background: \"var(--lp-rule-strong)\" }}\n                    />\n                  )}\n\n                  <div>\n                    <div className=\"flex items-center justify-between gap-2\">\n                      <h3\n                        className=\"text-[20px] font-semibold tracking-[-0.02em]\"\n                        style={{ fontFamily: \"var(--lp-display, inherit)\" }}\n                      >\n                        {tier.name}\n                      </h3>\n                      {inv && (\n                        <span\n                          className=\"px-2 py-0.5 text-[10px] font-bold tracking-[0.1em] uppercase\"\n                          style={{ background: \"var(--lp-signal)\", color: \"var(--lp-on-signal)\" }}\n                        >\n                          Most popular\n                        </span>\n                      )}\n                    </div>\n\n                    <p\n                      className=\"mt-2 min-h-[40px] text-[13.5px] leading-[1.52]\"\n                      style={{ color: inv ? \"var(--lp-invert-muted)\" : \"var(--lp-ink-2)\" }}\n                    >\n                      {tier.tagline}\n                    </p>\n\n                    <div\n                      className=\"mt-6 flex items-baseline gap-1.5 border-b pb-6\"\n                      style={{ borderColor: inv ? \"var(--lp-invert-rule)\" : \"var(--lp-rule)\" }}\n                    >\n                      <span\n                        className=\"text-[46px] leading-none font-semibold tracking-[-0.04em] tabular-nums\"\n                        style={{ fontFamily: \"var(--lp-display, inherit)\" }}\n                      >\n                        {price !== null ? `$${price}` : \"Custom\"}\n                      </span>\n                      {price !== null && (\n                        <span className=\"text-[13px]\" style={{ color: inv ? \"var(--lp-invert-muted)\" : \"var(--lp-ink-3)\" }}>\n                          / month\n                        </span>\n                      )}\n                    </div>\n\n                    <ul className=\"mt-5 space-y-3\">\n                      {tier.features.map((feat) => (\n                        <li\n                          key={feat}\n                          className=\"flex items-start gap-2.5 text-[13.5px] leading-[1.45]\"\n                          style={{ color: inv ? \"var(--lp-invert-ink)\" : \"var(--lp-ink-2)\" }}\n                        >\n                          <Check\n                            className=\"mt-[2px] size-4 shrink-0 stroke-[2.25]\"\n                            style={{ color: inv ? \"var(--lp-signal)\" : \"var(--lp-ink)\" }}\n                            aria-hidden=\"true\"\n                          />\n                          <span>{feat}</span>\n                        </li>\n                      ))}\n                    </ul>\n                  </div>\n\n                  <button\n                    type=\"button\"\n                    disabled={isBusy}\n                    onClick={() => handleChoose(tier, price)}\n                    className=\"group mt-8 flex h-12 w-full cursor-pointer items-center justify-between border px-4 text-[13.5px] font-semibold transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-default disabled:opacity-70\"\n                    style={{\n                      touchAction: \"manipulation\",\n                      borderColor: inv ? \"var(--lp-signal)\" : \"var(--lp-rule-strong)\",\n                      background: inv ? \"var(--lp-signal)\" : \"transparent\",\n                      color: inv ? \"var(--lp-on-signal)\" : \"var(--lp-ink)\",\n                      outlineColor: \"var(--lp-signal)\",\n                    }}\n                  >\n                    <span>{isBusy ? \"Opening…\" : isSelected ? `${tier.name} selected` : tier.ctaLabel}</span>\n                    {isSelected ? (\n                      <Check className=\"size-4\" aria-hidden=\"true\" />\n                    ) : (\n                      <ArrowRight className=\"size-4 transition-transform duration-200 group-hover:translate-x-1\" aria-hidden=\"true\" />\n                    )}\n                  </button>\n                </article>\n              );\n            })}\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n"}],"css":{},"docs":"Docs and live preview: https://hairlineui.com/blocks/ledger-pricing. MIT licensed: https://hairlineui.com/license#components","meta":{"license":"MIT"}}