Xzero UI
Pro library

FAQ section

FAQs as an accordion, a topic rail, or a searchable list that highlights matches.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/faq-section
Live · keyboard ready

Use this as a starting point and replace the sample data with your own.

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/faq-section

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { FaqSection } from "@/components/xzero/blocks/faq-section/faq-section";

export function PricingFaq() {
  return (
    <FaqSection
      variant="search"
      title="Questions about billing"
      items={[
        { question: "Can I cancel anytime?", answer: "Yes. Your plan stays active until the end of the billing period." },
        { question: "Do you offer refunds?", answer: "We refund annual plans within 14 days of purchase." },
      ]}
      contact={{ label: "Talk to billing", href: "mailto:billing@example.com" }}
    />
  );
}

API reference

FaqSection

An FAQ in three layouts: one centered accordion, questions grouped beside a category rail, or a list that filters as you type.

PropTypeDefaultDescription
variant"accordion" | "columns" | "search""accordion"Layout.
titlestring"Frequently asked questions"Section heading.
descriptionstring–One line under the heading.
items{ id?: string; question: string; answer: string; category?: string }[]faqExampleItemsQuestions. answer is plain text and is what search matches. category groups the columns variant.
multiplebooleanfalseAllow several answers open at once.
valuestring[]–Open item ids (controlled). Ids default to the question.
defaultValuestring[]–Initially open ids when uncontrolled.
onValueChange(value: string[]) => void–Called when answers open or close.
categorystring–Active category in the columns variant (controlled).
onCategoryChange(category: string) => void–Called when the category changes.
querystring–Search text in the search variant (controlled).
onQueryChange(query: string) => void–Called as the search text changes.
contact{ label: string; description?: string; href?: string; onClick?: () => void } | null–A way to reach a person when the answer isn't here. Pass null to hide it.
classNamestring–Extra class on the section.

FaqSectionBlock

Default export: a preview with a layout switcher.

PropTypeDefaultDescription
variantFaqSectionVariant"accordion"Initial variant.

Keyboard interactions

KeysAction
ArrowUp / ArrowDownMove between questions in one list.
Home / EndFirst or last question.
Enter / SpaceOpens or closes the focused answer.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Blocks are complete, self-contained screens with sample data. Replace the sample data and connect the callbacks described above. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components