"use client";
import { Accordion } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
items | readonly AccordionItem[] | — | Items to render. |
defaultOpen | boolean | — | Single-item mode (no items): open when uncontrolled. |
defaultValue | string | null | — | Open item id when uncontrolled; null for all closed. |
headingLevel | 1 | 2 | 3 | 4 | 5 | 6 | — | Level of the heading around each trigger (1–6, default 3): match the page outline. |
multiple | false | — | One panel open at a time (default). Any number of panels open. |
onOpenChange | (open: boolean) => void | — | Single-item mode: called with the next open state. |
onValueChange | (value: string | null) => void | — | Called with the open item id, or null when it closes. |
open | boolean | — | Single-item mode: open state (controlled). |
title | ReactNode | — | Single-item mode: the trigger text. |
value | string | null | — | Open item id (controlled); null for all closed. |
itemsreadonly AccordionItem[]
Items to render.
defaultOpenboolean
Single-item mode (no items): open when uncontrolled.
defaultValuestring | null
Open item id when uncontrolled; null for all closed.
headingLevel1 | 2 | 3 | 4 | 5 | 6
Level of the heading around each trigger (1–6, default 3): match the page outline.
multiplefalse
One panel open at a time (default). Any number of panels open.
onOpenChange(open: boolean) => void
Single-item mode: called with the next open state.
onValueChange(value: string | null) => void
Called with the open item id, or null when it closes.
openboolean
Single-item mode: open state (controlled).
titleReactNode
Single-item mode: the trigger text.
valuestring | null
Open item id (controlled); null for all closed.
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
const items = [
{ id: "install", title: "Install", content: "pnpm add @pixxl-tools/components" },
{ id: "theme", title: "Theme", content: "Wrap the app in PixxlProvider." },
];
<Accordion items={items} />