Accordion
items: [{ key, title, content, disabled? }]. One section is open at a time unless multiple is set. Control it with value (array of open keys) and onChange, or use defaultValue. The headers are h3 headings; set headingLevel (2 to 6) so they follow the heading above without skipping a level.
By default the items share one border. Set gap to sm, md or lg to space them apart as separate bordered items.
AccordionSection is one collapsible section on its own, for pages that put other content between sections. Control it with open and onChange, or use defaultOpen.
Any other content can sit between the sections.
Props
Accordion
itemsAccordionItem[]Sections. See the AccordionItem table below.
valuestring[]Open keys (controlled).
defaultValuestring[]Default:[]Initially open keys (uncontrolled).
onChange(keys: string[]) => voidCalled with the new array of open keys.
multiplebooleanDefault:falseAllow several sections open at once.
gap'none' | 'sm' | 'md' | 'lg'Default:'none'Space between items (0.5 / 1 / 1.5rem). Any gap gives each item its own border.
headingLevel2 | 3 | 4 | 5 | 6Default:3Level of the headers' headings (h2 to h6), so they follow the heading above without skipping a level.
classNamestringDefault:''Extra classes for the root element.
| Prop | Type | Default | Description |
|---|---|---|---|
items | AccordionItem[] | – | Sections. See the AccordionItem table below. |
value | string[] | – | Open keys (controlled). |
defaultValue | string[] | [] | Initially open keys (uncontrolled). |
onChange | (keys: string[]) => void | – | Called with the new array of open keys. |
multiple | boolean | false | Allow several sections open at once. |
gap | 'none' | 'sm' | 'md' | 'lg' | 'none' | Space between items (0.5 / 1 / 1.5rem). Any gap gives each item its own border. |
headingLevel | 2 | 3 | 4 | 5 | 6 | 3 | Level of the headers' headings (h2 to h6), so they follow the heading above without skipping a level. |
className | string | '' | Extra classes for the root element. |
AccordionItem
keystringUnique key of the section.
titleReactNodeText of the section header.
contentReactNodeShown while the section is open.
disabledbooleanDefault:falseDim the section and keep it closed.
| Prop | Type | Default | Description |
|---|---|---|---|
key | string | – | Unique key of the section. |
title | ReactNode | – | Text of the section header. |
content | ReactNode | – | Shown while the section is open. |
disabled | boolean | false | Dim the section and keep it closed. |
AccordionSection
titleReactNodeHeader content.
openbooleanOpen state (controlled).
defaultOpenbooleanDefault:falseInitially open (uncontrolled).
onChange(open: boolean) => voidCalled with the new open state.
disabledbooleanDefault:falseDisable the header.
headingLevel2 | 3 | 4 | 5 | 6Default:3Level of the header's heading (h2 to h6), so it follows the heading above without skipping a level.
classNamestringDefault:'border border-app-border'Classes for the section frame (replaces the default border).
childrenReactNodeContent.
| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | – | Header content. |
open | boolean | – | Open state (controlled). |
defaultOpen | boolean | false | Initially open (uncontrolled). |
onChange | (open: boolean) => void | – | Called with the new open state. |
disabled | boolean | false | Disable the header. |
headingLevel | 2 | 3 | 4 | 5 | 6 | 3 | Level of the header's heading (h2 to h6), so it follows the heading above without skipping a level. |
className | string | 'border border-app-border' | Classes for the section frame (replaces the default border). |
children | ReactNode | – | Content. |