{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "faq",
  "title": "FAQ",
  "description": "A frequently asked questions section with a header and the answers in an accordion, split or stacked.",
  "registryDependencies": [
    "@corsair-ui/utils",
    "@corsair-ui/accordion"
  ],
  "files": [
    {
      "path": "registry/default/components/blocks/faq.tsx",
      "content": "import type { ComponentProps, ReactNode } from \"react\";\nimport { cn } from \"@/registry/default/lib/utils\";\nimport {\n  Accordion,\n  AccordionContent,\n  AccordionItem,\n  AccordionTrigger,\n} from \"@/registry/default/ui/accordion\";\n\ninterface FaqItem {\n  /** Used as the React key and the accordion value; falls back to `item-<index>`. */\n  id?: string;\n  question: ReactNode;\n  answer: ReactNode;\n}\n\ninterface FaqProps extends Omit<ComponentProps<\"section\">, \"title\" | \"defaultValue\"> {\n  eyebrow?: ReactNode;\n  title?: ReactNode;\n  description?: ReactNode;\n  items?: FaqItem[];\n  /** \"split\" puts the header on the left and the questions on the right on large screens. */\n  layout?: \"stacked\" | \"split\";\n  /** \"single\" keeps one answer open at a time; \"multiple\" lets several stay open. */\n  type?: \"single\" | \"multiple\";\n  /** Item value(s) open on first render: an item's `id`, or `item-<index>`. */\n  defaultValue?: string | string[];\n  /** Shown under the header, e.g. a link to contact. Pass `null` to hide. */\n  footer?: ReactNode;\n}\n\nconst DEFAULT_ITEMS: FaqItem[] = [\n  {\n    id: \"trial\",\n    question: \"Is there a free trial?\",\n    answer:\n      \"Yes. Every paid plan starts with a 14-day trial with all features included. No card is needed to start.\",\n  },\n  {\n    id: \"change-plan\",\n    question: \"Can I change plans later?\",\n    answer:\n      \"You can upgrade or downgrade at any time from your account settings. Changes apply from the next billing period.\",\n  },\n  {\n    id: \"team\",\n    question: \"How do I invite my team?\",\n    answer:\n      \"Open the workspace settings and add people by email. They get an invitation link and join with the role you pick.\",\n  },\n  {\n    id: \"data\",\n    question: \"Where is my data stored?\",\n    answer:\n      \"Your data is encrypted in transit and at rest, and backed up daily. You can export everything at any time.\",\n  },\n  {\n    id: \"cancel\",\n    question: \"What happens if I cancel?\",\n    answer:\n      \"Your workspace stays available until the end of the billing period. After that it switches to the free plan and nothing is deleted.\",\n  },\n  {\n    id: \"support\",\n    question: \"Do you offer support?\",\n    answer:\n      \"All plans include help by email. Pro and Enterprise plans get priority replies and a dedicated contact.\",\n  },\n];\n\nconst DEFAULT_FOOTER = (\n  <>\n    Still have questions?{\" \"}\n    <a\n      href=\"#contact\"\n      className=\"text-foreground focus-visible:ring-ring/50 rounded font-medium underline underline-offset-4 outline-none hover:no-underline focus-visible:ring-[3px]\"\n    >\n      Contact us\n    </a>\n  </>\n);\n\n/**\n * A frequently asked questions section: a header and the questions in an\n * accordion. The default \"split\" layout puts the header on the left and the\n * questions on the right on large screens; \"stacked\" centres the header above\n * a narrower list. `type=\"single\"` (the default) keeps one answer open and\n * lets it close again; `type=\"multiple\"` lets several stay open.\n * `defaultValue` opens items by `id` (or `item-<index>` when there is none).\n * `footer` replaces the \"Still have questions?\" line.\n *\n * Accessibility: the title is an `<h2>` and each question is a button inside\n * an `<h3>`; Tab reaches the questions, Enter or Space toggles them, and Up,\n * Down, Home and End move between them.\n *\n * @example\n * <Faq\n *   title=\"Questions\"\n *   layout=\"stacked\"\n *   items={[{ question: \"Can I pay yearly?\", answer: \"Yes, with two months free.\" }]}\n * />\n */\nfunction Faq({\n  className,\n  eyebrow = \"FAQ\",\n  title = \"Frequently asked questions\",\n  description = \"Answers to the questions we hear most. Cannot find what you are looking for? Reach out.\",\n  items = DEFAULT_ITEMS,\n  layout = \"split\",\n  type = \"single\",\n  defaultValue,\n  footer = DEFAULT_FOOTER,\n  ...props\n}: FaqProps) {\n  const split = layout === \"split\";\n  const hasHeader = eyebrow != null || title != null || description != null || footer != null;\n\n  const entries = items.map((item, index) => (\n    <AccordionItem key={item.id ?? index} value={item.id ?? `item-${index}`} data-slot=\"faq-item\">\n      <AccordionTrigger data-slot=\"faq-question\" className=\"text-base\">\n        {item.question}\n      </AccordionTrigger>\n      <AccordionContent data-slot=\"faq-answer\" className=\"text-muted-foreground text-base\">\n        {item.answer}\n      </AccordionContent>\n    </AccordionItem>\n  ));\n\n  const listClassName = cn(\"w-full\", !split && \"mx-auto max-w-3xl\", !split && hasHeader && \"mt-12\");\n\n  return (\n    <section\n      data-slot=\"faq\"\n      data-layout={layout}\n      className={cn(\"py-16 sm:py-24\", className)}\n      {...props}\n    >\n      <div\n        data-slot=\"faq-container\"\n        className={cn(\n          \"mx-auto w-full max-w-6xl px-4 sm:px-6\",\n          split && \"grid gap-12 lg:grid-cols-[1fr_2fr]\"\n        )}\n      >\n        {hasHeader ? (\n          <div data-slot=\"faq-header\" className={cn(\"max-w-2xl\", !split && \"mx-auto text-center\")}>\n            {eyebrow != null ? (\n              <p data-slot=\"faq-eyebrow\" className=\"text-muted-foreground text-sm font-medium\">\n                {eyebrow}\n              </p>\n            ) : null}\n            {title != null ? (\n              <h2\n                data-slot=\"faq-title\"\n                className={cn(\n                  \"text-3xl font-semibold tracking-tight text-balance sm:text-4xl\",\n                  eyebrow != null && \"mt-2\"\n                )}\n              >\n                {title}\n              </h2>\n            ) : null}\n            {description != null ? (\n              <p\n                data-slot=\"faq-description\"\n                className=\"text-muted-foreground mt-4 text-lg text-pretty\"\n              >\n                {description}\n              </p>\n            ) : null}\n            {footer != null ? (\n              <p data-slot=\"faq-footer\" className=\"text-muted-foreground mt-6 text-sm\">\n                {footer}\n              </p>\n            ) : null}\n          </div>\n        ) : null}\n        {type === \"multiple\" ? (\n          <Accordion\n            type=\"multiple\"\n            data-slot=\"faq-list\"\n            className={listClassName}\n            defaultValue={\n              defaultValue === undefined\n                ? undefined\n                : Array.isArray(defaultValue)\n                  ? defaultValue\n                  : [defaultValue]\n            }\n          >\n            {entries}\n          </Accordion>\n        ) : (\n          <Accordion\n            type=\"single\"\n            collapsible\n            data-slot=\"faq-list\"\n            className={listClassName}\n            defaultValue={Array.isArray(defaultValue) ? defaultValue[0] : defaultValue}\n          >\n            {entries}\n          </Accordion>\n        )}\n      </div>\n    </section>\n  );\n}\n\nexport { Faq, type FaqItem, type FaqProps };\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:block"
}