Accordion
Wraps a set of expansion panels so that opening one automatically closes any other open panel.
Account
Notifications
Privacy
Overview
Accordions are vertically grouped sections with headers and associated expandable content areas that manage the display of multiple related content sections. The accordion ensures that only one section can be expanded at any given time, automatically collapsing other open panels when a new one is expanded. This creates a focused user experience where attention is directed to a single content area.
Usage
forge-accordion wraps a set of expansion panel children and closes any other open panel whenever one of them opens, through its panelSelector property for scoping to panels that aren’t direct children. It adds no visual styling of its own; pair it with a divider between panels for visual separation. If a design calls for more than one panel open at a time, skip the accordion wrapper entirely and use expansion panels on their own.
Rules
Basic usage
Give each panel a header-slotted button; opening one panel automatically closes any other open panel in the same accordion.
An accordion wrapping three panels, only one open at a time.
<forge-accordion class="w-[200px] inline-block">
<forge-expansion-panel orientation="vertical" animation-type="default" trigger open-icon name>
<div slot="header" class="flex justify-between items-center">
Panel One
<forge-open-icon orientation="vertical" rotation="full">
</forge-open-icon>
</div>
<div id="forge-expansion-panel-content-dmk3t">
Panel One Content
</div>
</forge-expansion-panel>
<forge-divider>
</forge-divider>
<forge-expansion-panel orientation="vertical" animation-type="default" trigger open-icon name>
<div slot="header" class="flex justify-between items-center">
Panel Two
<forge-open-icon orientation="vertical" rotation="full">
</forge-open-icon>
</div>
<div id="forge-expansion-panel-content-1ogog">
Panel Two Content
</div>
</forge-expansion-panel>
<forge-divider>
</forge-divider>
<forge-expansion-panel orientation="vertical" animation-type="default" trigger open-icon name>
<div slot="header" class="flex justify-between items-center">
Panel Three
<forge-open-icon orientation="vertical" rotation="full">
</forge-open-icon>
</div>
<div id="forge-expansion-panel-content-kxzv3">
Panel Three Content
</div>
</forge-expansion-panel>
</forge-accordion>Accordions wrap a collection of expansion panels to ensure that only one panel is expanded at a time.
import "@tylertech/forge/accordion";| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
panelSelector | panel-selector | string | undefined | — | Gets/sets the selector to use for finding the child expansion panels. Defaults to searching the direct children for `<forge-expansion-panel>` elements. Use this if you need to scope this accordion to a specific set of expansion panels, or your expansion panels are not direct children of the accordion. |
| Name | Type | Description |
|---|---|---|
forge-accordion-toggle | CustomEvent<IExpansionPanelComponent> | Dispatched when a child expansion panel is toggled. Includes the related expansion panel element in the event detail. |
Keyboard interaction
- Every panel in the accordion should be reachable by keyboard navigation, with a visible focus cue.
- Pressing Space or Enter on a focused panel should toggle it open or closed the same way a click would.
Nested interactive content
If an open panel contains a link, button, or other navigation element, those should be included in the tab order while tabbing through the accordion. If a closed panel contains any of that content, it should be skipped instead.