Accordion

The Accordion component allows you to show and hide content sections with expand and collapse interactions.

Usage

Default

This is the content revealed when expanded.

<Accordion title="Default Accordion">
  <p>This is the content revealed when expanded.</p>
</Accordion>

Props

Data table
TypeDescription
aria-describedbystringID reference for describing the accordion toggle button. This can supplement or replace the generated description ID.
aria-labelstringAccessible label for the accordion toggle button. Useful when the visible title is not descriptive enough.
aria-labelledbystringID reference for labeling the accordion toggle button. Prefer this when an external visible label already exists.
asyncContentbooleanIf true, the accordion content is loaded asynchronously.
childrenReactNodeThe content to display when the accordion is expanded.
classNamestringAdditional custom class names for the wrapper element.
customCollapsedIconReactNodeCustom icon to display when the accordion is collapsed.
customExpandedIconReactNodeCustom icon to display when the accordion is expanded.
data-testidstringOptional test ID for testing frameworks.
descriptionstringAccessible description. This can be announced to assistive technologies via aria-describedby.
disabledbooleanIf true, disables user interaction and styles the accordion as disabled.
expandedbooleanIf set, enables controlled mode. Determines whether the accordion is expanded.
iconPosition"left" | "right"Position of accordion toggle icon.
idstringOptional custom ID for the accordion content section. If not provided, a unique ID will be generated.
initiallyExpandedbooleanIf true, the accordion is initially expanded (uncontrolled mode).
isToggleablebooleanIf true, the accordion can be toggled open or closed. If false, the accordion is always expanded.
lazyLoadbooleanIf true, the accordion content will be loaded lazily.
loadingAriaLabelstringAnnounces loading state for assistive technologies when async content is enabled.
onToggle((expanded: boolean) => void)Callback triggered when the accordion header is toggled. Receives the new expanded state.
outlinebooleanIf true, applies an outline style to the accordion.
regionAriaDescribedBystringID reference for describing the content region.
regionAriaLabelstringAccessible label for the expanded content region. Usually not needed if ariaLabelledBy/aria-labelledby is already sufficient.
regionAriaLabelledBystringID reference for labeling the content region. Overrides the default button-based relationship when needed.
roleReact.AriaRoleOptional role override for the outer wrapper. Leave undefined in most cases.
roundingRoundingTypeControls the rounding of the accordion.
shadowShadowTypeControls the shadow of the accordion.
sizeSizeTypeThe size of the accordion.
stateStateTypeThe state of the accordion ('success' | 'error' | 'warning').
themeThemeTypeThe theme color of the accordion.
titlestringThe title text displayed in the accordion header.