{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "comparator-table",
  "title": "Comparator Table",
  "description": "Tiered feature-comparison table Payload block: plan columns with CTAs over grouped feature rows.",
  "registryDependencies": [
    "badge"
  ],
  "files": [
    {
      "path": "payload-components/source/blocks/shared/comparatorFields.ts",
      "content": "import type { Field } from 'payload'\n\n/**\n * Shared field core for the Comparator component family.\n *\n * Every comparator variant (comparator-table, comparator-grid, comparator-stack)\n * spreads this optional section header first and then appends its own plan/feature\n * shape — the feature matrix for the table and grid layouts, or the per-plan\n * checklists for the stacked layout. Editing the shared title/description here\n * updates every installed comparator block at once, so the family never drifts\n * field-by-field across a repo.\n *\n * Installed once per repo at `src/blocks/shared/comparatorFields.ts`; re-running\n * `payload-components add comparator-*` never overwrites a copy you have already edited.\n */\nexport const comparatorFields: Field[] = [\n  {\n    name: 'title',\n    type: 'text',\n  },\n  {\n    name: 'description',\n    type: 'textarea',\n  },\n]\n",
      "type": "registry:file",
      "target": "~/src/blocks/shared/comparatorFields.ts"
    },
    {
      "path": "payload-components/source/blocks/ComparatorTable/config.ts",
      "content": "import type { Block } from 'payload'\n\nimport { comparatorFields } from '@/blocks/shared/comparatorFields'\nimport { linkGroup } from '@/fields/linkGroup'\n\nexport const ComparatorTable: Block = {\n  slug: 'comparatorTable',\n  // Existing apps must migrate stored data before adopting this identifier:\n  // https://www.payload-components.xyz/docs/registry#installed-source-and-migrations\n  dbName: 'pc_com_tab',\n  interfaceName: 'ComparatorTableBlock',\n  fields: [\n    // Shared comparator header (title, description). Variant-specific fields\n    // follow; edit the shared shape in @/blocks/shared/comparatorFields.\n    ...comparatorFields,\n    {\n      name: 'plans',\n      type: 'array',\n      required: true,\n      minRows: 2,\n      maxRows: 4,\n      admin: {\n        initCollapsed: true,\n      },\n      fields: [\n        {\n          name: 'name',\n          type: 'text',\n          required: true,\n        },\n        {\n          name: 'badge',\n          type: 'text',\n          admin: {\n            description: 'Optional pill above the plan name, e.g. \"Most popular\".',\n          },\n        },\n        {\n          name: 'highlighted',\n          type: 'checkbox',\n          admin: {\n            description: 'Tints this column to draw the eye to the recommended plan.',\n          },\n        },\n        linkGroup({\n          overrides: {\n            maxRows: 1,\n          },\n        }),\n      ],\n    },\n    {\n      name: 'features',\n      type: 'array',\n      required: true,\n      minRows: 1,\n      admin: {\n        initCollapsed: true,\n      },\n      fields: [\n        {\n          name: 'groupLabel',\n          type: 'text',\n          admin: {\n            description: 'Optional section heading rendered as a divider row above this feature.',\n          },\n        },\n        {\n          name: 'feature',\n          type: 'text',\n          required: true,\n        },\n        {\n          name: 'values',\n          type: 'array',\n          admin: {\n            description: 'One cell per plan, in the same order as Plans. Tick \"included\" for a checkmark, or set a label for a text value.',\n          },\n          fields: [\n            {\n              name: 'included',\n              type: 'checkbox',\n            },\n            {\n              name: 'label',\n              type: 'text',\n            },\n          ],\n        },\n      ],\n    },\n  ],\n  labels: {\n    plural: 'Comparator Table Blocks',\n    singular: 'Comparator Table',\n  },\n}\n",
      "type": "registry:file",
      "target": "~/src/blocks/ComparatorTable/config.ts"
    },
    {
      "path": "payload-components/source/blocks/ComparatorTable/Component.tsx",
      "content": "import React from 'react'\n\nimport { Check } from 'lucide-react'\n\nimport type { ComparatorTableBlock as ComparatorTableBlockData } from '@/payload-types'\n\nimport { CMSLink } from '@/components/Link'\nimport { Badge } from '@/components/ui/badge'\nimport { cn } from '@/utilities/ui'\n\n// Layout adapted from tailark/blocks (MIT) — re-implemented as a Payload block.\n\ntype Props = ComparatorTableBlockData & {\n  id?: string\n  className?: string\n  disableInnerContainer?: boolean\n}\n\nexport const ComparatorTableBlock: React.FC<Props> = ({\n  className,\n  description,\n  disableInnerContainer,\n  features,\n  id,\n  plans,\n  title,\n}) => {\n  const planCount = plans?.length ?? 0\n\n  return (\n    <section className={cn('container', className)} id={id ? `block-${id}` : undefined}>\n      <div className=\"overflow-hidden rounded-frame border border-border/70 bg-card/35 px-6 py-10 sm:px-8 lg:px-12 lg:py-14\">\n        <div\n          className={cn('flex flex-col gap-10', {\n            'mx-auto max-w-5xl': !disableInnerContainer,\n          })}\n        >\n          {title || description ? (\n            <div className=\"flex max-w-2xl flex-col gap-4\">\n              {title ? (\n                <h2 className=\"text-4xl font-medium tracking-display text-balance sm:text-5xl\">{title}</h2>\n              ) : null}\n\n              {description ? (\n                <p className=\"text-base leading-7 text-muted-foreground sm:text-lg\">{description}</p>\n              ) : null}\n            </div>\n          ) : null}\n\n          {plans && plans.length > 0 ? (\n            <div className=\"overflow-x-auto\">\n              <table className=\"w-full border-collapse text-start text-sm\">\n                <thead>\n                  <tr>\n                    <th className=\"w-2/5 p-4 align-bottom\" />\n                    {plans.map((plan, planIndex) => (\n                      <th\n                        key={plan.id ?? planIndex}\n                        scope=\"col\"\n                        className={cn('min-w-40 p-4 align-bottom', {\n                          'bg-primary/5': plan.highlighted,\n                        })}\n                      >\n                        <div className=\"flex flex-col gap-3\">\n                          <div className=\"flex flex-wrap items-center gap-2\">\n                            <span className=\"text-base font-medium text-foreground\">{plan.name}</span>\n\n                            {plan.badge ? (\n                              <Badge\n                                variant=\"outline\"\n                                className=\"rounded-full px-2 py-0.5 text-xs uppercase tracking-eyebrow\"\n                              >\n                                {plan.badge}\n                              </Badge>\n                            ) : null}\n                          </div>\n\n                          {plan.links && plan.links.length > 0 ? (\n                            <div className=\"flex flex-col gap-2\">\n                              {plan.links.map(({ link }, linkIndex) => (\n                                <CMSLink\n                                  key={linkIndex}\n                                  appearance={link.appearance === 'outline' ? 'outline' : 'default'}\n                                  {...link}\n                                />\n                              ))}\n                            </div>\n                          ) : null}\n                        </div>\n                      </th>\n                    ))}\n                  </tr>\n                </thead>\n\n                <tbody>\n                  {features?.map((row, rowIndex) => (\n                    <React.Fragment key={row.id ?? rowIndex}>\n                      {row.groupLabel ? (\n                        <tr>\n                          <td\n                            className=\"px-4 pb-2 pt-8 text-xs font-medium uppercase tracking-eyebrow text-muted-foreground\"\n                            colSpan={planCount + 1}\n                          >\n                            {row.groupLabel}\n                          </td>\n                        </tr>\n                      ) : null}\n\n                      <tr className=\"border-t border-border/70\">\n                        <td className=\"p-4 text-muted-foreground\">{row.feature}</td>\n\n                        {plans.map((plan, planIndex) => {\n                          const cell = row.values?.[planIndex]\n\n                          return (\n                            <td\n                              key={plan.id ?? planIndex}\n                              className={cn('p-4 text-foreground', {\n                                'bg-primary/5': plan.highlighted,\n                              })}\n                            >\n                              {cell?.included ? (\n                                <Check aria-label=\"Included\" className=\"size-4 text-primary\" role=\"img\" />\n                              ) : cell?.label ? (\n                                <span>{cell.label}</span>\n                              ) : (\n                                <span className=\"text-muted-foreground\">—</span>\n                              )}\n                            </td>\n                          )\n                        })}\n                      </tr>\n                    </React.Fragment>\n                  ))}\n                </tbody>\n              </table>\n            </div>\n          ) : null}\n        </div>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:file",
      "target": "~/src/blocks/ComparatorTable/Component.tsx"
    }
  ],
  "meta": {
    "payloadComponent": {
      "installCommand": "payload-components add comparator-table",
      "postInstall": [
        "generate:types",
        "generate:importmap"
      ],
      "requiresPayloadComponentWrapper": true,
      "supportedTargets": [
        "payload-website-starter",
        "payload-blocks-app"
      ]
    }
  },
  "docs": "Payload Components installs this as a Payload CMS block for the Payload website starter shape.\n\nRecommended install:\n\n```bash\npnpm payload-components add comparator-table\n```\n\nDirect shadcn install URL:\n\n```bash\npnpm dlx shadcn@latest add https://www.payload-components.xyz/r/comparator-table.json\n```\n\nDirect shadcn installs only copy the block source files and shadcn UI dependencies. Use `payload-components add comparator-table` when you also want Payload layout registration, `RenderBlocks` wiring, `generate:types`, and `generate:importmap` handled for you.",
  "type": "registry:block"
}