Accordion
A vertically stacked set of interactive headings that each reveal an associated section of content.
Features
- Full keyboard navigation.
- Expands one panel at a time.
- Can be controlled or uncontrolled.
Install the component from your command line.
Import the components and piece the parts together.
Create your styled accordion component from the primitive parts.
Contains all the parts of an accordion.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div | |
value | string | ||
defaultValue | string | ||
disabled | boolean | false | |
onValueChange | function |
Contains all the parts of a collapsible section.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div | |
disabled | boolean | false | |
value | string |
Wraps an Accordion.Button
. Use the as
prop to update it to the appropriate heading level for your page.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | h3 |
Toggles the collapsed state of its associated item. It should be nested inside of an Accordion.Header
.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | button |
Contains the collapsible content for an item.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div |
Here goes the content for the accordion item 2.
Adheres to the Accordion WAI-ARIA design pattern.
Key | Description |
---|---|
Space | When focus is on an Accordion.Button of a collapsed section, expands the section. |
Enter | When focus is on an Accordion.Button of a collapsed section, expands the section. |
Tab | Moves focus to the next focusable element. |
Shift + Tab | Moves focus to the previous focusable element. |
ArrowDown | Moves focus to the next Accordion.Button . |
ArrowUp | Moves focus to the previous Accordion.Button . |
Home | When focus is on an Accordion.Button , moves focus to the first Accordion.Button . |
End | When focus is on an Accordion.Button , moves focus to the last Accordion.Button . |