Accordion
Accordion and AccordionItem are built on React Aria’s DisclosureGroup and Disclosure
primitives. Each item has a trigger button and a collapsible panel.
Add via CLI
Section titled “Add via CLI”npx @a2ra/cli add accordionMultiple expanded
Section titled “Multiple expanded”Example JSON
Section titled “Example JSON”{ "type": "Accordion", "children": [ { "type": "AccordionItem", "props": { "id": "q1", "heading": "What is A2UI?" }, "children": "A2UI is a JSON schema for describing UI components." } ]}Accordion props
Section titled “Accordion props”| Prop | Type | Description |
|---|---|---|
allowsMultipleExpanded | truefalse default | When true, multiple items can be open at once |
isDisabled | truefalse default | Disables all items in the group |
children | node[] | One or more AccordionItem nodes |
AccordionItem props
Section titled “AccordionItem props”| Prop | Type | Description |
|---|---|---|
heading | string | Trigger button label (required) |
id | string | Stable identifier for the disclosure |
defaultExpanded | truefalse default | Whether the item starts open |
isDisabled | truefalse default | Disables this item’s trigger |
children | stringnode[] | Panel content |
headingis required on everyAccordionItem; it becomes the accessible trigger button label.- By default only one item can be open at a time. Opening a new item automatically closes the previous one.
- The chevron rotates 180° when the panel is expanded via a CSS transition on
[data-expanded].