{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "faq-categories",
  "type": "registry:component",
  "title": "FAQ Categories",
  "description": "Category tabs with a sliding pill switch between sets of question cards, which slide and fade in from the direction you moved. Arrow keys move between tabs.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "faq",
    "faq",
    "tabs",
    "categories",
    "help center",
    "cards",
    "keyboard"
  ],
  "docs": "https://hyperblur.dev/effects/faq-categories",
  "files": [
    {
      "path": "registry/hyperblur/faq-categories.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/faq-categories.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface FaqCategoryQuestion {\n  question: string;\n  answer: React.ReactNode;\n}\n\nexport interface FaqCategory {\n  id: string;\n  label: string;\n  icon?: React.ReactNode;\n  items: FaqCategoryQuestion[];\n}\n\nexport interface FaqCategoriesLink {\n  label: string;\n  href: string;\n}\n\nexport interface FaqCategoriesProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\" | \"defaultValue\" | \"onChange\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  categories?: FaqCategory[];\n  value?: string;\n  defaultValue?: string;\n  onValueChange?: (id: string) => void;\n  contact?: FaqCategoriesLink | null;\n  accent?: string;\n}\n\nconst css = `\n.hb-kd7 {\n  --hb-kd7-accent: #8b5cf6;\n  box-sizing: border-box;\n  container-type: inline-size;\n  position: relative;\n  width: 100%;\n  overflow: hidden;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-kd7 *, .hb-kd7 *::before, .hb-kd7 *::after { box-sizing: border-box; }\n.hb-kd7::before {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  background:\n    radial-gradient(40% 50% at 15% 0%, color-mix(in srgb, var(--hb-kd7-accent) 15%, transparent), transparent 70%),\n    radial-gradient(35% 45% at 90% 100%, color-mix(in srgb, var(--hb-kd7-accent) 9%, transparent), transparent 70%);\n  pointer-events: none;\n}\n.hb-kd7-in {\n  position: relative;\n  max-width: 1040px;\n  margin: 0 auto;\n  padding: 88px 24px 100px;\n}\n.hb-kd7-head { max-width: 620px; margin: 0 auto; text-align: center; }\n.hb-kd7-eyebrow {\n  margin: 0;\n  color: color-mix(in srgb, var(--hb-kd7-accent) 55%, #fff);\n  font-size: 13px;\n  font-weight: 600;\n  letter-spacing: .14em;\n  text-transform: uppercase;\n}\n.hb-kd7-title {\n  margin: 14px 0 0;\n  font-size: clamp(30px, 4.8cqi, 46px);\n  font-weight: 600;\n  line-height: 1.08;\n  letter-spacing: -.03em;\n  text-wrap: balance;\n}\n.hb-kd7-sub { margin: 14px 0 0; color: #8f8f8f; font-size: 16px; line-height: 1.6; }\n.hb-kd7-tabs {\n  position: relative;\n  display: grid;\n  grid-template-columns: repeat(var(--hb-kd7-n, 3), minmax(0, 1fr));\n  width: min(100%, 520px);\n  margin: 36px auto 0;\n  padding: 5px;\n  border: 1px solid rgba(255, 255, 255, .08);\n  border-radius: 999px;\n  background: rgba(255, 255, 255, .03);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);\n}\n.hb-kd7-pill {\n  position: absolute;\n  top: 5px;\n  bottom: 5px;\n  left: 5px;\n  width: calc((100% - 10px) / var(--hb-kd7-n, 3));\n  border-radius: 999px;\n  background: linear-gradient(180deg, color-mix(in srgb, var(--hb-kd7-accent) 85%, #fff), var(--hb-kd7-accent));\n  box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset, 0 8px 24px -8px color-mix(in srgb, var(--hb-kd7-accent) 80%, transparent);\n  transform: translate3d(calc(100% * var(--hb-kd7-i, 0)), 0, 0);\n  transition: transform .5s cubic-bezier(.3, 1.3, .5, 1);\n}\n.hb-kd7-tab {\n  position: relative;\n  z-index: 1;\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: 8px;\n  min-width: 0;\n  height: 42px;\n  margin: 0;\n  padding: 0 12px;\n  border: 0;\n  border-radius: 999px;\n  background: transparent;\n  color: #a1a1a1;\n  font: inherit;\n  font-size: 14px;\n  font-weight: 550;\n  white-space: nowrap;\n  cursor: pointer;\n  transition: color .3s ease;\n}\n.hb-kd7-tab:hover { color: #ededed; }\n.hb-kd7-tab[aria-selected=\"true\"] { color: #fff; }\n.hb-kd7-tab:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }\n.hb-kd7-tab svg { flex: none; width: 16px; height: 16px; }\n.hb-kd7-count {\n  display: grid;\n  place-items: center;\n  min-width: 20px;\n  height: 18px;\n  padding: 0 5px;\n  border-radius: 999px;\n  background: rgba(255, 255, 255, .08);\n  font-size: 11px;\n  font-variant-numeric: tabular-nums;\n}\n.hb-kd7-tab[aria-selected=\"true\"] .hb-kd7-count { background: rgba(255, 255, 255, .22); }\n.hb-kd7-panel { margin-top: 44px; outline: none; }\n.hb-kd7-panel:focus-visible { outline: 2px solid var(--hb-kd7-accent); outline-offset: 8px; border-radius: 16px; }\n.hb-kd7-grid {\n  display: grid;\n  grid-template-columns: repeat(2, minmax(0, 1fr));\n  gap: 14px;\n  margin: 0;\n  padding: 0;\n  list-style: none;\n}\n.hb-kd7-card {\n  position: relative;\n  height: 100%;\n  padding: 24px 24px 26px;\n  border: 1px solid rgba(255, 255, 255, .07);\n  border-radius: 18px;\n  background: linear-gradient(180deg, #131313, #0e0e0e);\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);\n  transition: border-color .3s ease, background-color .3s ease;\n  animation: hb-kd7-in .55s cubic-bezier(.2, .8, .2, 1) both;\n  animation-delay: var(--hb-kd7-d, 0s);\n}\n.hb-kd7-panel[data-dir=\"-1\"] .hb-kd7-card { animation-name: hb-kd7-in-back; }\n.hb-kd7-card:hover { border-color: color-mix(in srgb, var(--hb-kd7-accent) 40%, rgba(255, 255, 255, .07)); }\n@keyframes hb-kd7-in {\n  from { opacity: 0; transform: translate3d(28px, 0, 0); filter: blur(4px); }\n  to { opacity: 1; transform: none; filter: blur(0); }\n}\n@keyframes hb-kd7-in-back {\n  from { opacity: 0; transform: translate3d(-28px, 0, 0); filter: blur(4px); }\n  to { opacity: 1; transform: none; filter: blur(0); }\n}\n.hb-kd7-q {\n  display: flex;\n  gap: 12px;\n  margin: 0;\n  font-size: 16px;\n  font-weight: 600;\n  line-height: 1.4;\n  letter-spacing: -.01em;\n}\n.hb-kd7-q::before {\n  content: \"\";\n  flex: none;\n  width: 7px;\n  height: 7px;\n  margin-top: 8px;\n  border-radius: 2px;\n  background: var(--hb-kd7-accent);\n  box-shadow: 0 0 12px var(--hb-kd7-accent);\n  transform: rotate(45deg);\n}\n.hb-kd7-a { margin: 10px 0 0 19px; color: #9a9a9a; font-size: 14.5px; line-height: 1.65; }\n.hb-kd7-foot {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  justify-content: center;\n  gap: 10px 16px;\n  margin-top: 40px;\n  color: #8f8f8f;\n  font-size: 14px;\n}\n.hb-kd7-link {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  min-height: 38px;\n  padding: 0 16px;\n  border: 1px solid rgba(255, 255, 255, .12);\n  border-radius: 999px;\n  color: #ededed;\n  font-weight: 500;\n  text-decoration: none;\n  transition: border-color .25s ease, background-color .25s ease;\n}\n.hb-kd7-link:hover { border-color: color-mix(in srgb, var(--hb-kd7-accent) 60%, transparent); background: color-mix(in srgb, var(--hb-kd7-accent) 12%, transparent); }\n.hb-kd7-link:focus-visible { outline: 2px solid var(--hb-kd7-accent); outline-offset: 3px; }\n.hb-kd7-link svg { width: 14px; height: 14px; }\n@container (max-width: 680px) {\n  .hb-kd7-grid { grid-template-columns: minmax(0, 1fr); }\n}\n@container (max-width: 520px) {\n  .hb-kd7-in { padding: 64px 16px 72px; }\n  .hb-kd7-tab { gap: 6px; padding: 0 6px; font-size: 13px; }\n  .hb-kd7-tab svg { display: none; }\n  .hb-kd7-panel { margin-top: 32px; }\n  .hb-kd7-card { padding: 20px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-kd7-pill, .hb-kd7-tab, .hb-kd7-card, .hb-kd7-link { transition: none; }\n  .hb-kd7-card { animation: none; }\n}\n`;\n\nconst icons = [\n  <svg key=\"card\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n    <rect x=\"1.5\" y=\"3.5\" width=\"13\" height=\"9\" rx=\"2\" />\n    <path d=\"M1.5 6.5h13M4 10h2.5\" />\n  </svg>,\n  <svg key=\"shield\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n    <path d=\"M8 1.5l5.5 2v4c0 3.4-2.3 5.9-5.5 7-3.2-1.1-5.5-3.6-5.5-7v-4L8 1.5z\" />\n    <path d=\"M5.8 8l1.6 1.6L10.4 6.5\" />\n  </svg>,\n  <svg key=\"box\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n    <path d=\"M8 1.5l6 3.2v6.6l-6 3.2-6-3.2V4.7l6-3.2z\" />\n    <path d=\"M2 4.7l6 3.3 6-3.3M8 8v6.5\" />\n  </svg>,\n];\n\nconst defaultCategories: FaqCategory[] = [\n  {\n    id: \"billing\",\n    label: \"Billing\",\n    items: [\n      { question: \"When will I be charged?\", answer: \"On the day your trial ends, and then on the same date every month or year. You get an email receipt three days before each renewal.\" },\n      { question: \"Which payment methods do you accept?\", answer: \"Visa, Mastercard, American Express, Apple Pay and SEPA debit. Annual plans over $5,000 can also be paid by bank transfer against an invoice.\" },\n      { question: \"Can I get an invoice with my VAT number?\", answer: \"Add your VAT or tax ID under Billing and every future invoice will include it. Past invoices can be reissued with one click.\" },\n      { question: \"What happens if a payment fails?\", answer: \"We retry three times over seven days and email the billing owner each time. Your workspace stays fully active during that window.\" },\n    ],\n  },\n  {\n    id: \"security\",\n    label: \"Security\",\n    items: [\n      { question: \"Are you SOC 2 compliant?\", answer: \"Yes. We hold a SOC 2 Type II report renewed every year, and an ISO 27001 certificate. Both are available under NDA from the trust center.\" },\n      { question: \"How is my data encrypted?\", answer: \"AES-256 at rest and TLS 1.3 in transit. Enterprise workspaces can bring their own keys through AWS KMS and rotate them on their schedule.\" },\n      { question: \"Do you support SSO and SCIM?\", answer: \"SAML single sign-on with Okta, Entra ID and Google Workspace, plus SCIM provisioning, are included on the Business and Enterprise plans.\" },\n      { question: \"Can I see who accessed what?\", answer: \"Audit logs record every sign-in, export and permission change for 400 days, and can be streamed to Datadog or Splunk in real time.\" },\n    ],\n  },\n  {\n    id: \"product\",\n    label: \"Product\",\n    items: [\n      { question: \"Does it work offline?\", answer: \"The desktop and mobile apps keep your last 30 days of documents available offline and sync every change the moment you reconnect.\" },\n      { question: \"Can I import from other tools?\", answer: \"One-click importers bring in projects from Notion, Confluence, Asana and Trello, including comments, attachments and assignees.\" },\n      { question: \"Is there a public API?\", answer: \"A REST API and webhooks are available on every plan, with typed SDKs for TypeScript and Python and a sandbox workspace for testing.\" },\n      { question: \"How often do you ship updates?\", answer: \"Small improvements go out daily and larger features every two weeks. The changelog lists every release with screenshots and migration notes.\" },\n    ],\n  },\n];\n\nexport function FaqCategories({\n  eyebrow = \"Help center\",\n  title = \"Answers, sorted by what you need\",\n  subtitle = \"Pick a topic to see the questions our customers ask most often.\",\n  categories = defaultCategories,\n  value,\n  defaultValue,\n  onValueChange,\n  contact = { label: \"Chat with our team\", href: \"#chat\" },\n  accent = \"#8b5cf6\",\n  className = \"\",\n  style,\n  ...rest\n}: FaqCategoriesProps) {\n  const uid = React.useId();\n  const tabsRef = React.useRef<HTMLDivElement>(null);\n  const [inner, setInner] = React.useState(defaultValue ?? categories[0]?.id ?? \"\");\n  const [dir, setDir] = React.useState(1);\n  const current = value ?? inner;\n  const foundIndex = categories.findIndex((c) => c.id === current);\n  const activeIndex = foundIndex === -1 ? 0 : foundIndex;\n  const active = categories[activeIndex];\n\n  const select = (index: number, focus = false) => {\n    const target = categories[index];\n    if (!target) return;\n    if (index !== activeIndex) {\n      setDir(index > activeIndex ? 1 : -1);\n      if (value === undefined) setInner(target.id);\n      onValueChange?.(target.id);\n    }\n    if (focus) tabsRef.current?.querySelectorAll<HTMLButtonElement>(\"[role='tab']\")[index]?.focus();\n  };\n\n  const onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n    const n = categories.length;\n    let next = -1;\n    if (e.key === \"ArrowRight\") next = (activeIndex + 1) % n;\n    else if (e.key === \"ArrowLeft\") next = (activeIndex - 1 + n) % n;\n    else if (e.key === \"Home\") next = 0;\n    else if (e.key === \"End\") next = n - 1;\n    if (next === -1) return;\n    e.preventDefault();\n    select(next, true);\n  };\n\n  const vars = {\n    \"--hb-kd7-accent\": accent,\n    \"--hb-kd7-n\": Math.max(1, categories.length),\n    \"--hb-kd7-i\": activeIndex,\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <section className={`hb-kd7 ${className}`} style={vars} aria-labelledby={`${uid}-t`} {...rest}>\n      <style href=\"hb-faq-categories\" precedence=\"default\">{css}</style>\n      <div className=\"hb-kd7-in\">\n        <header className=\"hb-kd7-head\">\n          {eyebrow && <p className=\"hb-kd7-eyebrow\">{eyebrow}</p>}\n          <h2 id={`${uid}-t`} className=\"hb-kd7-title\">{title}</h2>\n          {subtitle && <p className=\"hb-kd7-sub\">{subtitle}</p>}\n        </header>\n        <div ref={tabsRef} className=\"hb-kd7-tabs\" role=\"tablist\" aria-label=\"Question topics\" onKeyDown={onKeyDown}>\n          <span className=\"hb-kd7-pill\" aria-hidden=\"true\" />\n          {categories.map((cat, i) => {\n            const selected = i === activeIndex;\n            return (\n              <button\n                key={cat.id}\n                id={`${uid}-tab-${i}`}\n                type=\"button\"\n                role=\"tab\"\n                className=\"hb-kd7-tab\"\n                aria-selected={selected}\n                aria-controls={`${uid}-panel`}\n                tabIndex={selected ? 0 : -1}\n                onClick={() => select(i)}\n              >\n                {cat.icon ?? icons[i % icons.length]}\n                <span>{cat.label}</span>\n                <span className=\"hb-kd7-count\">{cat.items.length}</span>\n              </button>\n            );\n          })}\n        </div>\n        {active && (\n          <div\n            key={active.id}\n            id={`${uid}-panel`}\n            className=\"hb-kd7-panel\"\n            role=\"tabpanel\"\n            aria-labelledby={`${uid}-tab-${activeIndex}`}\n            tabIndex={0}\n            data-dir={dir}\n          >\n            <ul className=\"hb-kd7-grid\">\n              {active.items.map((item, i) => (\n                <li key={`${item.question}-${i}`}>\n                  <div className=\"hb-kd7-card\" style={{ \"--hb-kd7-d\": `${(i * 0.06).toFixed(2)}s` } as React.CSSProperties}>\n                    <h3 className=\"hb-kd7-q\">{item.question}</h3>\n                    <div className=\"hb-kd7-a\">{item.answer}</div>\n                  </div>\n                </li>\n              ))}\n            </ul>\n          </div>\n        )}\n        {contact && (\n          <div className=\"hb-kd7-foot\">\n            <span>Did not find your answer?</span>\n            <a className=\"hb-kd7-link\" href={contact.href}>\n              <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                <path d=\"M2.5 3.5h11v7h-6l-3 2.5v-2.5h-2v-7z\" />\n              </svg>\n              {contact.label}\n            </a>\n          </div>\n        )}\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}