Accordion
StableAccessible
Accordions can be used to hide and reveal information. When used correctly, they are a good way to make a higher amount of information easier to digest for the user.
Code
Code examples
Default
With a card
With the close button hidden
Accordion size variants
Stacked Accordions
Custom accordion
Packages
Package | Included | Storybook link | Source link |
---|---|---|---|
HDS React | Yes | View in Storybook | View source |
HDS Core | No | - | - |
Properties
Note! You can find the full list of properties in the React Storybook.
Property | Description | Values | Default value |
---|---|---|---|
heading | Heading of the accordion | - | - |
headingLevel | Sets the aria-level of the accordion header. | 1-6 | 2 |
border | If set to true, a border will be drawn around the accordion card. | boolean | false |
card | If set to true, the accordion will use HDS Card as its background element. | boolean | false |
closeButton | If set to true, a close button is shown at the bottom of an expanded accordion | boolean | true |
initiallyOpen | If set to true, the accordion will be initially opened. | boolean | false |
This component also accepts all nativediv
element props.