{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "faq-accordion",
  "title": "FAQ Accordion",
  "description": "Payload FAQ block: a centered accordion of question/answer items with an optional CTA.",
  "registryDependencies": [
    "accordion",
    "badge"
  ],
  "files": [
    {
      "path": "payload-components/source/blocks/shared/faqFields.ts",
      "content": "import type { Field } from 'payload'\n\n/**\n * Shared field core for the FAQ component family.\n *\n * Every FAQ variant (faq-accordion, faq-split, faq-card, faq-icons,\n * faq-grouped, faq-grid) spreads these section-heading fields first and then\n * appends its own variant-specific shape — the question/answer items, which\n * differ per layout (flat list, icon-tagged, or grouped). Editing the shared\n * eyebrow/title/description here updates every installed FAQ block at once, so\n * the family never drifts field-by-field across a repo.\n *\n * Installed once per repo at `src/blocks/shared/faqFields.ts`; re-running\n * `payload-components add faq-*` never overwrites a copy you have already edited.\n */\nexport const faqFields: Field[] = [\n  {\n    name: 'eyebrow',\n    type: 'text',\n  },\n  {\n    name: 'title',\n    type: 'text',\n    required: true,\n  },\n  {\n    name: 'description',\n    type: 'textarea',\n  },\n]\n\n/**\n * Reusable question/answer array for the plain FAQ variants (faq-accordion,\n * faq-split, faq-card, faq-grid). The icon and grouped variants define their\n * own item shape, so they compose `faqFields` but not this field.\n */\nexport const faqItemsField: Field = {\n  name: 'items',\n  type: 'array',\n  required: true,\n  minRows: 1,\n  admin: {\n    initCollapsed: true,\n  },\n  fields: [\n    {\n      name: 'question',\n      type: 'text',\n      required: true,\n    },\n    {\n      name: 'answer',\n      type: 'textarea',\n      required: true,\n    },\n  ],\n}\n",
      "type": "registry:file",
      "target": "~/src/blocks/shared/faqFields.ts"
    },
    {
      "path": "payload-components/source/blocks/FaqAccordion/config.ts",
      "content": "import type { Block } from 'payload'\n\nimport { faqFields, faqItemsField } from '@/blocks/shared/faqFields'\nimport { linkGroup } from '@/fields/linkGroup'\n\nexport const FaqAccordion: Block = {\n  slug: 'faqAccordion',\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_faq_acc',\n  interfaceName: 'FaqAccordionBlock',\n  fields: [\n    // Shared FAQ core (eyebrow, title, description). Variant-specific fields\n    // follow; edit the shared shape in @/blocks/shared/faqFields.\n    ...faqFields,\n    faqItemsField,\n    linkGroup({\n      overrides: {\n        admin: {\n          initCollapsed: true,\n        },\n        maxRows: 1,\n      },\n    }),\n  ],\n  labels: {\n    plural: 'FAQ Accordion Blocks',\n    singular: 'FAQ Accordion',\n  },\n}\n",
      "type": "registry:file",
      "target": "~/src/blocks/FaqAccordion/config.ts"
    },
    {
      "path": "payload-components/source/blocks/FaqAccordion/Component.tsx",
      "content": "import React from 'react'\n\nimport type { FaqAccordionBlock as FaqAccordionBlockData } from '@/payload-types'\n\nimport { CMSLink } from '@/components/Link'\nimport {\n  Accordion,\n  AccordionContent,\n  AccordionItem,\n  AccordionTrigger,\n} from '@/components/ui/accordion'\nimport { Badge } from '@/components/ui/badge'\nimport { cn } from '@/utilities/ui'\n\ntype Props = FaqAccordionBlockData & {\n  id?: string\n  className?: string\n  disableInnerContainer?: boolean\n}\n\nexport const FaqAccordionBlock: React.FC<Props> = ({\n  className,\n  description,\n  disableInnerContainer,\n  eyebrow,\n  id,\n  items,\n  links,\n  title,\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-3xl': !disableInnerContainer,\n          })}\n        >\n          <div className=\"flex flex-col gap-4 text-center\">\n            {eyebrow ? (\n              <Badge variant=\"outline\" className=\"mx-auto w-fit rounded-full px-3 py-1 uppercase tracking-eyebrow\">\n                {eyebrow}\n              </Badge>\n            ) : null}\n\n            <h2 className=\"text-4xl font-medium tracking-display text-balance sm:text-5xl\">{title}</h2>\n\n            {description ? (\n              <p className=\"text-base leading-7 text-muted-foreground sm:text-lg\">{description}</p>\n            ) : null}\n          </div>\n\n          {items && items.length > 0 ? (\n            <Accordion type=\"single\" collapsible className=\"w-full\">\n              {items.map((item, index) => (\n                <AccordionItem\n                  key={item.id ?? `${item.question}-${index}`}\n                  value={item.id ?? `item-${index}`}\n                  className=\"border-border/70\"\n                >\n                  <AccordionTrigger className=\"text-start text-base tracking-title hover:no-underline\">\n                    {item.question}\n                  </AccordionTrigger>\n                  <AccordionContent className=\"text-sm leading-7 text-muted-foreground\">\n                    {item.answer}\n                  </AccordionContent>\n                </AccordionItem>\n              ))}\n            </Accordion>\n          ) : null}\n\n          {links && links.length > 0 ? (\n            <div className=\"flex flex-col gap-3 sm:flex-row sm:justify-center\">\n              {links.map(({ link }, index) => (\n                <CMSLink\n                  key={index}\n                  appearance={link.appearance === 'outline' ? 'outline' : 'default'}\n                  {...link}\n                />\n              ))}\n            </div>\n          ) : null}\n        </div>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:file",
      "target": "~/src/blocks/FaqAccordion/Component.tsx"
    }
  ],
  "meta": {
    "payloadComponent": {
      "installCommand": "payload-components add faq-accordion",
      "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 faq-accordion\n```\n\nDirect shadcn install URL:\n\n```bash\npnpm dlx shadcn@latest add https://www.payload-components.xyz/r/faq-accordion.json\n```\n\nDirect shadcn installs only copy the block source files and shadcn UI dependencies. Use `payload-components add faq-accordion` when you also want Payload layout registration, `RenderBlocks` wiring, `generate:types`, and `generate:importmap` handled for you.",
  "type": "registry:block"
}