Accordion
A vertically stacked set of interactive headings that each reveal an associated section of content.
Features
- Full keyboard navigation.
- Supports horizontal/vertical orientation.
- Supports Right to Left direction.
- Can expand one or multiple items.
- Can be controlled or uncontrolled.
API Reference
Root
Prop | Default | Type |
---|---|---|
disabled | false | boolean Whether the Accordion is disabled. |
orientation | 'vertical' | RdxAccordionOrientation The orientation of the accordion. |
defaultValue | — | string | string[] The value of the item to expand when initially rendered and type is "single". Use when you do not need to control the state of the items. |
type | 'single' | RdxAccordionType Determines whether one or multiple items can be opened at the same time. |
value | — | string | string[] The controlled value of the item to expand. |
Emit | Payload |
---|---|
onValueChange |
[value: void]
Event handler called when the expanded state of an item changes and type is "multiple". |
Data Attribute | Value |
---|---|
[data-orientation] | "vertical" | "horizontal" |
Item
Contains all the parts of a collapsible section.
Prop | Default | Type |
---|---|---|
expanded | false | boolean |
value | — | string Accordion value. |
disabled | false | boolean Whether the option is disabled. |
Data Attribute | Value |
---|---|
[data-state] | "open" | "closed" |
[data-disabled] | Present when disabled |
[data-orientation] | "vertical" | "horizontal" |
Header
Wraps an rdxAccordionTrigger
.
Data Attribute | Value |
---|---|
[data-state] | "open" | "closed" |
[data-disabled] | Present when disabled |
[data-orientation] | "vertical" | "horizontal" |
Trigger
Toggles the collapsed state of its associated item. It should be nested inside an rdxAccordionHeader
.
Data Attribute | Value |
---|---|
[data-state] | "open" | "closed" |
[data-disabled] | Present when disabled |
[data-orientation] | "vertical" | "horizontal" |
Content
Contains the collapsible content for an item.
Data Attribute | Value |
---|---|
[data-state] | "open" | "closed" |
[data-disabled] | Present when disabled |
[data-orientation] | "vertical" | "horizontal" |
CSS Variable | Description |
---|---|
--radix-accordion-content-width | The width of the content when it opens/closes |
--radix-accordion-content-height | The height of the content when it opens/closes |