Accordion
Organize and display content in a compact, collapsible format, commonly used for FAQ sections.
Usage
Examples
Type
Use the type prop to change how the content should be displayed!
-
single: only allow one content to be shown at a time -
multiple: allow multiple contents to be shown at the same time.
Collapsible
Use the collapsible prop to determine whether all the accordion is collapsible! By default, it is set to true. Please note this only works when type="single".
Disabled
The disabled prop exists in both Accordion and AccordionItem components.
Setting disabled to true in Accordion will disable all the AccordionItem components, while in AccordionItem will disable the respective AccordionItem.
Props
Accordion
| Prop | Type | Default |
|---|---|---|
type | enum | - |
value | string|string[] | - |
defaultValue | string|string[] | - |
onValueChange | string|string[] | - |
collapsible | string|string[] | - |
disabled | string|string[] | - |
AccordionItem
| Prop | Type | Default |
|---|---|---|
asChild | boolean | false |
value | string|string[] | - |
disabled | string|string[] | - |
AccordionTrigger
| Prop | Type | Default |
|---|---|---|
asChild | boolean | false |
AccordionContent
| Prop | Type | Default |
|---|---|---|
asChild | boolean | false |
For more in-depth customization, you can refer to API references in this documentation