{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pricing-table",
  "type": "registry:block",
  "title": "Pricing table",
  "description": "Plans side by side with a Monthly / Yearly switch. The highlighted plan uses the inverse Card and a 'Most popular' Badge. Columns wrap to one per row on mobile.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://unbuiltui.com/r/badge.json",
    "https://unbuiltui.com/r/button.json",
    "https://unbuiltui.com/r/card.json",
    "https://unbuiltui.com/r/tabs.json",
    "https://unbuiltui.com/r/utils.json"
  ],
  "files": [
    {
      "path": "components/blocks/pricing-table.tsx",
      "type": "registry:component",
      "target": "components/blocks/pricing-table.tsx",
      "content": "\"use client\";\n\nimport { CheckIcon } from \"lucide-react\";\nimport { useState } from \"react\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardDescription, CardFooter, CardHeader } from \"@/components/ui/card\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@/components/ui/tabs\";\nimport { cn } from \"@/lib/utils\";\n\n// UnbuiltUI block: plans side by side with a monthly or yearly switch. The highlighted\n// plan uses the inverse card and a \"Most popular\" badge; all prices share one baseline.\n\nexport type PricingPlan = {\n  id: string;\n  name: string;\n  description: string;\n  /** Price per month for each billing period; 0 shows \"Free\". */\n  price: { monthly: number; yearly: number };\n  features: string[];\n  cta: string;\n  highlighted?: boolean;\n};\n\ntype PricingTableProps = {\n  plans: PricingPlan[];\n  title?: string;\n  description?: string;\n  currency?: string;\n  locale?: string;\n  /** Shown on the Yearly tab, e.g. \"Save 20%\". */\n  yearlyNote?: string;\n  defaultPeriod?: \"monthly\" | \"yearly\";\n  onSelect?: (plan: PricingPlan, period: \"monthly\" | \"yearly\") => void;\n  className?: string;\n};\n\nconst periods = [\"monthly\", \"yearly\"] as const;\n\nfunction PricingTable({\n  plans,\n  title = \"Pick a plan\",\n  description = \"Start free and upgrade when your team grows.\",\n  currency = \"USD\",\n  locale = \"en-US\",\n  yearlyNote = \"Save 20%\",\n  defaultPeriod = \"yearly\",\n  onSelect,\n  className,\n}: PricingTableProps) {\n  const [active, setActive] = useState(defaultPeriod);\n  const money = new Intl.NumberFormat(locale, {\n    style: \"currency\",\n    currency,\n    maximumFractionDigits: 0,\n  });\n\n  return (\n    <section\n      data-slot=\"pricing-table\"\n      className={cn(\"flex w-full flex-col items-center gap-8\", className)}\n    >\n      <div className=\"flex max-w-xl flex-col items-center gap-2 text-center\">\n        <h2 className=\"font-semibold text-3xl tracking-tight\">{title}</h2>\n        <p className=\"text-muted-foreground\">{description}</p>\n      </div>\n\n      <Tabs\n        value={active}\n        onValueChange={(value) => setActive(value as typeof active)}\n        className=\"w-full items-center gap-8\"\n      >\n        <TabsList>\n          <TabsTrigger value=\"monthly\">Monthly</TabsTrigger>\n          <TabsTrigger value=\"yearly\">\n            Yearly\n            {yearlyNote && <span className=\"text-brand\">{yearlyNote}</span>}\n          </TabsTrigger>\n        </TabsList>\n\n        {periods.map((period) => (\n          <TabsContent\n            key={period}\n            value={period}\n            className=\"grid w-full gap-4\"\n            style={{ gridTemplateColumns: \"repeat(auto-fit, minmax(min(100%, 260px), 1fr))\" }}\n          >\n            {plans.map((plan) => {\n              const price = plan.price[period];\n              return (\n                <Card\n                  key={plan.id}\n                  variant={plan.highlighted ? \"inverse\" : \"default\"}\n                  className=\"gap-6 py-6\"\n                >\n                  <CardHeader className=\"gap-2\">\n                    <div className=\"flex items-center justify-between gap-2\">\n                      <h3 className=\"font-semibold text-lg\">{plan.name}</h3>\n                      {plan.highlighted && <Badge variant=\"brand\">Most popular</Badge>}\n                    </div>\n                    <CardDescription>{plan.description}</CardDescription>\n                  </CardHeader>\n                  <CardContent className=\"flex flex-col gap-6\">\n                    <p className=\"flex items-baseline gap-1\">\n                      <span className=\"font-semibold text-4xl tracking-tight tabular-nums\">\n                        {price === 0 ? \"Free\" : money.format(price)}\n                      </span>\n                      {price > 0 && (\n                        <span\n                          className={cn(\n                            \"text-sm\",\n                            plan.highlighted\n                              ? \"text-primary-foreground/70\"\n                              : \"text-muted-foreground\",\n                          )}\n                        >\n                          / month{period === \"yearly\" ? \", billed yearly\" : \"\"}\n                        </span>\n                      )}\n                    </p>\n                    <ul className=\"flex flex-col gap-2.5 text-sm\">\n                      {plan.features.map((feature) => (\n                        <li key={feature} className=\"flex gap-2.5\">\n                          <CheckIcon\n                            aria-hidden=\"true\"\n                            className={cn(\n                              \"mt-0.5 size-4 shrink-0\",\n                              plan.highlighted ? \"text-primary-foreground\" : \"text-brand\",\n                            )}\n                          />\n                          {feature}\n                        </li>\n                      ))}\n                    </ul>\n                  </CardContent>\n                  <CardFooter className=\"mt-auto\">\n                    <Button\n                      size=\"lg\"\n                      className=\"w-full\"\n                      variant={plan.highlighted ? \"brand\" : \"outline\"}\n                      onClick={() => onSelect?.(plan, period)}\n                    >\n                      {plan.cta}\n                    </Button>\n                  </CardFooter>\n                </Card>\n              );\n            })}\n          </TabsContent>\n        ))}\n      </Tabs>\n    </section>\n  );\n}\n\nexport { PricingTable };\n"
    }
  ]
}
