eds-accordion
Explore the Interactive Component
Use the playground below to experiment with the component. Click the button to view the full Storybook deployment for additional examples and configurations.
See It in Use with Code
Check out this practical implementation of component.
The heading is set with the title attribute (it maps to the heading prop), and anything placed inside the element goes into the default slot as the collapsible content.
When you’re using the component directly in HTML (or in frameworks that don’t support property binding), you must pass the values like:
Slotted eds-alert
In React
In Vue
Properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
clampText | clamp-text | Clamps the description text when the accordion is collapsed to prevent overflow | boolean | true |
description | description | Optional description displayed below the title in the header | string | undefined |
expanded | expanded | Determines if the accordion is expanded by default | boolean | false |
heading | title | The title of the accordion, displayed in the header area | string | undefined |
icon | icon | Optional icon displayed in the header | "copy" | "arrow-right" | "chevron-right" | "chevron-left" | "chevron-down" | "chevron-up" | "arrow-left" | "arrow-up-right" | "close" | "subtract" | "add" | "branch" | "history" | "locked" | "unlocked" | "edit" | "checkmark" | "download" | "upload" | "view" | "exit" | "caretSort" | "bookmark" | "createLink" | "activity" | "account" | "analytics" | "template" | "documentExport" | "documentDownload" | "trashCan" | "chooseItem" | "copyLink" | "dragHorizontal" | "dragVertical" | "login" | "logout" | "move" | "replicate" | "sortAscending" | "sortDescending" | "requestQuote" | "reset" | "resultDraft" | "share" | "play" | "book" | "chatOff" | "forum" | "shareKnowledge" | "time" | "help" | "customerService" | "code" | "rocket" | "compass" | "sparkle" | "menu" | "search" | "settings" | "notification" | "user" | "group" | "building" | "overflow" | "save" | "document" | "folder" | "image" | "calendar" | "information" | "warning" | "error" | "checkmark-filled" | "star" | "thumbs-up" | "thumbs-down" | "star-outline" | "thumbs-up-outline" | "thumbs-down-outline" | "twitter" | "linkedin" | "facebook" | "youtube" | "mastodon" | "bluesky" | "gitlab" | undefined |
switchBg | switch-bg | [DEPRECATED] Use variant prop instead. Kept for backward compatibility. | boolean | true |
variant | variant | Visual variant: ‘default’ for dark background, ‘inverse’ for light background | "default" | "inverse" | 'inverse' |
Events
| Event | Description | Type |
|---|---|---|
accordion | Event emitted when the accordion toggles, indicating the new expanded/collapsed state | CustomEvent<boolean> |
Dependencies
Used by
Depends on
Graph
graph TD; eds-accordion --> eds-icon-wrapper eds-kg-learning-resources --> eds-accordion eds-matomo-notice --> eds-accordion style eds-accordion fill:#f9f,stroke:#333,stroke-width:4px
Built with StencilJS