{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "faq",
  "title": "FAQ",
  "description": "A landing page’s questions beside their heading: the title, its line and who to ask stay in view on the start side while the numbered questions scroll past, and several answers open at once.",
  "dependencies": [],
  "registryDependencies": [
    "https://kinoui.com/r/accordion.json",
    "https://kinoui.com/r/avatar.json",
    "https://kinoui.com/r/controllable.json",
    "https://kinoui.com/r/faq-parts.json",
    "https://kinoui.com/r/link-target.json",
    "https://kinoui.com/r/number-format.json",
    "https://kinoui.com/r/section-heading.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/faq/faq.tsx",
      "content": "'use client'\n\nimport {\n  Accordion,\n  AccordionPanel,\n  AccordionItem,\n  AccordionTrigger,\n} from '@/registry/components/kino/accordion'\nimport { useControllable } from '@/registry/lib/controllable'\nimport {\n  faqAnswerClassName,\n  faqColumnClassName,\n  type FaqSectionProps,\n  type FaqQuestion,\n  faqQuestionClassName,\n  faqSectionClassName,\n} from '@/registry/lib/faq-parts'\nimport { linkTargetClassName, useLinkTarget } from '@/registry/lib/link-target'\nimport { numberFormatter } from '@/registry/lib/number-format'\nimport { HEADING_BELOW, SectionHeading } from '@/registry/lib/section-heading'\nimport { useCallback, useId, useRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * A landing page's questions beside their heading: the title, its line and\n * who to ask on the start side, where they stay while the list scrolls past,\n * and the questions, numbered, on the end side. Any number of answers stay\n * open at once, so a visitor can compare two. Closed answers stay in the\n * page, so the browser's find opens the one it finds.\n *\n *   <Faq\n *     title='Questions, answered.'\n *     questions={[{ value: 'cancel', question: 'Can we cancel at any time?', answer: '…' }]}\n *     contact={<FaqContact title='Still have a question?' action={<NudgeLink href='mailto:help@kino.app'>Write to us</NudgeLink>} />}\n *   />\n */\n\ninterface FaqProps extends FaqSectionProps {\n  questions: FaqQuestion[]\n  /** The open questions, by their `value`. */\n  value?: string[]\n  /** The questions open at first: none, unless you give some. */\n  defaultValue?: string[]\n  onValueChange?: (value: string[]) => void\n}\n\n/** Two digits, so the questions' numbers line up: 01 to 99. */\nconst twoDigits = numberFormatter('en-US', { minimumIntegerDigits: 2 })\n\nfunction Faq({\n  title,\n  description,\n  eyebrow,\n  heading = 'h2',\n  contact,\n  questions,\n  value: valueProp,\n  defaultValue,\n  onValueChange,\n  className,\n  ...props\n}: FaqProps) {\n  const titleId = useId()\n  const ref = useRef<HTMLElement>(null)\n  const [open, setOpen] = useControllable(valueProp, defaultValue ?? [], onValueChange)\n  useLinkTarget(\n    ref,\n    useCallback(\n      (value: string) => questions.some((question) => question.value === value),\n      [questions],\n    ),\n    useCallback(\n      (value: string) => {\n        if (!open.includes(value)) setOpen([...open, value])\n      },\n      [open, setOpen],\n    ),\n  )\n  return (\n    <section\n      ref={ref}\n      data-slot='faq'\n      aria-labelledby={titleId}\n      className={cn(faqSectionClassName, className)}\n      {...props}\n    >\n      <div\n        className={cn(\n          faqColumnClassName,\n          'grid gap-10 @3xl/faq:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] @3xl/faq:gap-16',\n        )}\n      >\n        {/* Beside a long list, it stays in view while the list scrolls past. */}\n        <div className='flex min-w-0 flex-col gap-8 @3xl/faq:sticky @3xl/faq:top-(--faq-sticky-top,--spacing(8)) @3xl/faq:self-start'>\n          <SectionHeading\n            id={titleId}\n            eyebrow={eyebrow}\n            title={title}\n            description={description}\n            heading={heading}\n            align='start'\n          />\n          {contact}\n        </div>\n        <Accordion\n          multiple\n          hiddenUntilFound\n          heading={HEADING_BELOW[heading]}\n          value={open}\n          onValueChange={(next) => setOpen(next.map(String))}\n          className='min-w-0 border-y'\n        >\n          {questions.map((question, index) => (\n            <AccordionItem\n              key={question.value}\n              value={question.value}\n              data-link-target={question.value}\n              className={linkTargetClassName}\n            >\n              <AccordionTrigger data-link-focus='' className='gap-4 py-5 [&>svg]:mt-1'>\n                <span\n                  aria-hidden\n                  className='text-muted-foreground w-6 shrink-0 text-sm leading-6 tabular-nums'\n                >\n                  {twoDigits.format(index + 1)}\n                </span>\n                <span className={cn(faqQuestionClassName, 'min-w-0 flex-1')}>\n                  <bdi>{question.question}</bdi>\n                </span>\n              </AccordionTrigger>\n              <AccordionPanel className={cn(faqAnswerClassName, 'ps-10 pe-8 pb-6')}>\n                {question.answer}\n              </AccordionPanel>\n            </AccordionItem>\n          ))}\n        </Accordion>\n      </div>\n    </section>\n  )\n}\n\nexport { Faq, type FaqProps }\n",
      "type": "registry:component",
      "target": "@components/kino/faq/faq.tsx"
    }
  ],
  "type": "registry:block"
}