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

Press Enter to start editing. Press Esc to stop editing.

With a card

Press Enter to start editing. Press Esc to stop editing.

With the close button hidden

Press Enter to start editing. Press Esc to stop editing.

Accordion size variants

Press Enter to start editing. Press Esc to stop editing.

Stacked Accordions

Press Enter to start editing. Press Esc to stop editing.

Custom accordion

Press Enter to start editing. Press Esc to stop editing.

Packages

PackageIncludedStorybook linkSource link
HDS React
Yes
View in StorybookView source
HDS Core
No
--

Properties

Note! You can find the full list of properties in the React Storybook.

PropertyDescriptionValuesDefault value
borderIf set to true, a border will be drawn around the accordion card.booleanfalse
cardIf set to true, the accordion will use HDS Card as its background element.booleanfalse
closeButtonIf set to true, a close button is shown at the bottom of an expanded accordionbooleantrue
headingHeading of the accordion--
headingLevelSets the aria-level of the accordion header.1-62
initiallyOpenIf set to true, the accordion will be initially opened.booleanfalse
sizeSize of the Accordion.AccordionSize or ("small", "medium", "large")"medium"

This component also accepts all nativediv element props.