Xzero UI
Pro library

Accordion

Progressively reveal supporting information in place.

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

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/accordion

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 { Accordion } from "@/components/xzero/accordion/accordion";

export function Faq() {
  return (
    <Accordion
      size="lg"
      items={[
        { title: "Can I cancel anytime?", content: "Yes. Your plan stays active until the period ends." },
        { title: "Do you offer refunds?", content: "Within 14 days of purchase, no questions asked." },
      ]}
    />
  );
}

API reference

Accordion

A single-open, collapsible list of question and answer rows built on Radix Accordion.

PropTypeDefaultDescription
items (required){ title: string; content: ReactNode }[]–Rows in order. The title is the trigger label; content fills the panel.
defaultOpennumber0Index of the row open on first render. Pass -1 to start with every row closed.
size"md" | "lg""md""lg" sets questions at the large text size for page-level FAQs.

Keyboard interactions

KeysAction
Enter / SpaceToggles the focused row.
ArrowDown / ArrowUpMoves focus between row triggers.
Home / EndJumps to the first or last trigger.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in expand

Guidance for AI tools

Accordion: Progressively reveal supporting information in place. 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