Accordion API
Full surface of @oge-ui/layout: the oge-accordion container, the declarative <oge-accordion-item> child with its four template slots, the nested oge-panel-bar, the stand-alone oge-expansion-panel and the config provider.
Properties Methods Events Types
OgeAccordion
oge-accordionProperties 23
Panels & expansion
| Name | Type | Default | Description |
|---|---|---|---|
items | readonly OgeAccordionItemData[] | undefined | — | Data-driven panels rendered after the projected <oge-accordion-item> children. |
expandedKeys | readonly string[] | [] | Keys of the expanded panels — two-way. The multi-expand counterpart of selectedIndex; only panels that declare a key can appear here. |
selectedIndex | number | -1 | Index of the expanded panel in single-expand mode — two-way. -1 means none; in multiple mode it reports the first expanded panel. |
multiple | boolean | false | Allows more than one panel to stay expanded. |
collapsible | boolean | false | Allows collapsing the last expanded panel, leaving none open. While false, that header is aria-disabled per the APG — it stays focusable. |
disabled | boolean | false | Disables the whole component. |
Rendering & animation
| Name | Type | Default | Description |
|---|---|---|---|
deferRendering | boolean | true | Instantiate a panel's content only when it first expands. |
keepAlive | boolean | true | Keep once-rendered panels mounted (hidden) so their state survives a collapse. Ignored while deferRendering is false. |
animation | boolean | number | true | Height animation: true uses the default duration, a number overrides it in milliseconds, false disables it. Always suppressed under prefers-reduced-motion. |
Appearance
| Name | Type | Default | Description |
|---|---|---|---|
togglePosition | 'start' | 'end' | 'end' | Side of the header the chevron sits on — logical, so RTL mirrors it. |
hideToggle | boolean | false | Hides the chevron entirely. Overridable per panel via <oge-accordion-item [hideToggle]>. |
collapsedHeaderHeight | string | undefined | — | Minimum height of a collapsed header (any CSS length). undefined lets size and the padding tokens decide. Material’s collapsedHeight. |
expandedHeaderHeight | string | undefined | — | Minimum height of an expanded header; falls back to collapsedHeaderHeight. Material’s expandedHeight. |
displayMode | 'default' | 'flat' | 'default' | flat removes the gutters between panels and joins them into one stack. |
stylingMode | 'outlined' | 'filled' | 'flat' | 'outlined' | Visual variant of the panels. |
size | 'sm' | 'md' | 'lg' | 'md' | Density of the header rows. |
Keyboard & accessibility
| Name | Type | Default | Description |
|---|---|---|---|
keyboardNavigation | boolean | true | Enables Up/Down/Home/End and Ctrl+PageUp/PageDown header navigation. The APG pattern itself requires only Enter/Space and Tab — this is the optional enhancement. |
typeAhead | boolean | true | Enables printable-character type-ahead over the panel titles. Matching is accent- and locale-insensitive. |
selectOnFocus | boolean | false | Expands a panel as soon as keyboard navigation moves focus onto it. |
headingLevel | number | 3 | aria-level of the heading wrapping each header button. |
useRegionRole | boolean | true | Gives each panel role="region" (APG-optional; adds one landmark per panel). |
ariaLabel | string | undefined | — | Aria label of the accordion container. |
messages | Partial<OgeAccordionMessages> | {} | Per-instance overrides of the config messages. |
Methods 8
| Name | Type | Description |
|---|---|---|
expand(target) | (target: number | string) => Promise<boolean> | Runs the expand pipeline for the panel at an index or with a key. Resolves true once it expanded, false if an unknown target, itemExpanding or the expandGuard vetoed it. |
collapse(target) | (target: number | string) => Promise<boolean> | Runs the collapse pipeline; resolves whether the panel actually collapsed. |
toggle(target) | (target: number | string) => Promise<boolean> | Expands the panel if collapsed, collapses it otherwise. |
expandAll() | () => void | Expands every enabled panel. Requires multiple — otherwise it warns in dev mode and does nothing. |
collapseAll() | () => void | Collapses every panel. In single-expand mode the last panel stays open unless collapsible is set. |
expandInvalid() | () => void | Expands every panel flagged invalid — call it after a failed form submit so the user sees each section needing attention. |
isExpanded(target) | (target: number | string) => boolean | Whether the panel at an index or with a key is currently expanded. |
focus(target?) | (target?: number | string) => void | Focuses a panel's header button, or the first enabled one. |
Events 11
| Name | Type | Description |
|---|---|---|
itemExpanding | OgeAccordionExpandingEvent | Cancelable pre-event of a panel expanding — set cancel = true to block it. Runs before the panel’s expandGuard. |
itemExpanded | OgeAccordionExpandedEvent | Emitted after a panel expanded. |
itemCollapsing | OgeAccordionCollapsingEvent | Cancelable pre-event of a panel collapsing — set cancel = true to block it. |
itemCollapsed | OgeAccordionCollapsedEvent | Emitted after a panel collapsed. |
afterExpand | OgeAccordionExpandedEvent | Emitted once the expand animation finished — the point at which the panel has its final height. Fires immediately when the animation is off or suppressed by prefers-reduced-motion. |
afterCollapse | OgeAccordionCollapsedEvent | Emitted once the collapse animation finished. |
itemClick | OgeAccordionItemClickEvent | Emitted when a header button is activated, before the expand pipeline runs. Fires for disabled panels too. |
itemContentLoaded | OgeAccordionContentLoadedEvent | Emitted after a panel's contentLoader resolved. |
itemContentFailed | OgeAccordionContentFailedEvent | Emitted after a panel's contentLoader rejected. |
expandedKeysChange | readonly string[] | Two-way model output of expandedKeys. |
selectedIndexChange | number | Two-way model output of selectedIndex. |
Types 7
Types
| Name | Type | Description |
|---|---|---|
OgeAccordionItemData | interface | Data-driven counterpart of a declarative panel: key, title, description, icon, badge, hint, disabled, visible, expanded, invalid, expandGuard, contentLoader. |
OgeAccordionExpandGuard | () => boolean | Promise<boolean> | Veto for a pending expand or collapse. false blocks it; throwing or rejecting is also a veto. While a promise is pending the panel shows a spinner and ignores further toggles (single-flight). |
OgeAccordionContentLoader | () => Promise<unknown> | Loads a panel's content the first time it expands. The resolved value reaches the content template as data. |
OgeAccordionTogglePosition | 'start' | 'end' | Chevron side inside the header button. |
OgeAccordionDisplayMode | 'default' | 'flat' | Gutters between panels, or one joined stack. |
OgeAccordionStylingMode | 'outlined' | 'filled' | 'flat' | Visual variant of the panels. |
OgeAccordionSize | 'sm' | 'md' | 'lg' | Density of the header rows. |
OgeAccordionItem
oge-accordion-itemProperties 15
| Name | Type | Default | Description |
|---|---|---|---|
title | string | '' | Header title; alternative to an inline [ogeAccordionHeaderTemplate]. |
text | string | undefined | — | Plain-text panel body, rendered when there is no projected content or content template. The reference html item field has no counterpart on purpose. |
description | string | undefined | — | Secondary line rendered under the title. |
key | string | undefined | — | Stable identity used by expandedKeys and DOM ids. |
icon | string | undefined | — | SVG path data (d) rendered as a 24×24 aria-hidden icon before the title. |
badge | string | number | undefined | — | Badge rendered after the title. |
hint | string | undefined | — | Tooltip — rendered as the native title attribute. |
disabled | boolean | false | Disabled panels cannot expand and are skipped by keyboard navigation. |
visible | boolean | true | false removes the panel entirely. |
expanded | boolean | false | Expanded state of this panel — two-way. Set it to expand on first render, bind it to follow the state, or write to it to drive the panel from outside. Writes still run the pipeline, so a veto reverts the binding. |
hideToggle | boolean | undefined | — | Overrides the accordion's hideToggle for this panel. |
togglePosition | 'start' | 'end' | undefined | — | Overrides the accordion's togglePosition for this panel. |
invalid | boolean | false | Flags the section as failing validation — renders the danger rail and feeds expandInvalid(). |
expandGuard | OgeAccordionExpandGuard | undefined | — | Veto hook run before this panel expands or collapses; may be async (single-flight). |
contentLoader | OgeAccordionContentLoader | undefined | — | Loads this panel's content on first expand, with a skeleton while pending and a retry button on failure. |
Methods 3
| Name | Type | Description |
|---|---|---|
open() | () => void | Expands this panel. Like a user gesture it runs the accordion’s pipeline, so itemExpanding and expandGuard can still veto it. |
close() | () => void | Collapses this panel, subject to collapsible and the guards. |
toggle() | () => void | Expands the panel if collapsed, collapses it otherwise. |
Types 5
Template slots
| Name | Type | Description |
|---|---|---|
[ogeAccordionHeaderTemplate] | { $implicit, index, expanded, title, description } | Replaces the built-in title/description/icon layout inside the header button. Component-level instances apply to items panels only (queried with descendants: false). Must not contain focusable controls. |
[ogeAccordionContentTemplate] | { $implicit, index, data } | Panel body; marks the content lazy. data carries the panel's contentLoader result. |
[ogeAccordionToggleIconTemplate] | { $implicit: boolean, index } | Replaces the chevron. Accordion-level chrome — a component-level instance applies to declarative children too. |
[ogeAccordionHeaderActionsTemplate] | { $implicit, index, expanded } | Per-panel actions rendered beside the toggle button, never inside it — real focusable controls without a nested-interactive violation. |
[ogeAccordionActionRow] | directive | Marks a row of buttons at the end of a panel body as its action bar (divider above, actions at the inline end) — the references' action-row slot. Inside the panel, so only reachable while expanded. |
OgePanelBar
oge-panel-barProperties 10
| Name | Type | Default | Description |
|---|---|---|---|
items | readonly OgePanelBarItem[] | undefined | — | The item tree. An entry with children is an expandable group; one with content (and no children) expands into free content; the rest are selectable leaves. content is plain text — the [ogePanelBarContentTemplate] slot renders anything richer. |
expandMode | 'single' | 'multiple' | 'full' | 'multiple' | Kendo's three modes: multiple lets groups open independently, single collapses a group's open siblings, full is single with the open root group filling the host's height (give the host one). |
selectedKey | string | undefined | — | The selected item — two-way ([(selectedKey)]): its key, or its position id (p0-1) when it has none. Announced as aria-current. |
expandedKeys | readonly string[] | undefined | — | Ids (key or position id) of the expanded groups — two-way. The items' own expanded flags seed it once; a consumer write replaces the state. |
disabled | boolean | false | Disables the whole panel bar; a disabled item disables its subtree and leaves the Tab sequence. |
deferRendering | boolean | true | Render a group's children or content only from its first expand on (kept afterwards); false renders every level up front. |
animation | boolean | number | true | Height animation: true uses the default duration, a number overrides it in milliseconds, false disables it. Suppressed under prefers-reduced-motion. |
keyboardNavigation | boolean | true | Enables Up/Down/Home/End and Right/Left header navigation. |
ariaLabel | string | undefined | — | Accessible name of the root list. |
Keyboard & accessibility
| Name | Type | Default | Description |
|---|---|---|---|
APG disclosure, not treeview | — | — | Kendo renders its PanelBar as role="tree", but a tree may own nothing but tree items — and panel bar groups may hold free content. So every header is a real <button> in the Tab sequence (aria-expanded + aria-controls on groups, aria-current on the selected leaf), collapsed groups are inert, and Up/Down/Home/End plus Right/Left (expand-or-enter / collapse-or-parent, mirrored in RTL) are layered on top. Collapsing a group that holds focus hands focus to its header. |
Methods 7
| Name | Type | Description |
|---|---|---|
isExpanded(id) | (id: string) => boolean | Whether the group with this id (key or position id) is expanded. |
expand(id) | (id: string) => Promise<boolean> | Runs the expand pipeline (cancelable pre-event, then commit); resolves whether the group ended up expanded. |
collapse(id) | (id: string) => Promise<boolean> | Runs the collapse pipeline; resolves whether the group ended up collapsed. |
toggle(id) | (id: string) => Promise<boolean> | Expands a collapsed group, collapses an expanded one. |
expandAll() | () => void | Expands every enabled group. multiple mode only — otherwise a dev-mode warning and a no-op. |
collapseAll() | () => void | Collapses every expanded group. |
focus(id?) | (id?: string) => void | Focuses a header by id, or the first enabled one. |
Events 8
| Name | Type | Description |
|---|---|---|
itemClick | OgePanelBarItemClickEvent | A header was activated — before it toggles or selects. |
itemExpanding | OgePanelBarItemExpandingEvent | Cancelable pre-event of a group expanding — set cancel = true to keep it closed. |
itemCollapsing | OgePanelBarItemCollapsingEvent | Cancelable pre-event of a group collapsing. |
itemExpanded | OgePanelBarItemToggleEvent | A group expanded. |
itemCollapsed | OgePanelBarItemToggleEvent | A group collapsed — also each sibling a single / full expand closed. |
selectionChanged | OgePanelBarSelectionChangedEvent | The selected item changed through a user click (previousKey included). |
selectedKeyChange | string | undefined | The banana half of [(selectedKey)]. |
expandedKeysChange | readonly string[] | undefined | The banana half of [(expandedKeys)]. |
Types 5
Types
| Name | Type | Description |
|---|---|---|
OgePanelBarItem | interface | key, title, description, icon (SVG path data), badge, hint, disabled, visible, expanded, selectable (default: leaves only), content and children. |
OgePanelBarExpandMode | 'single' | 'multiple' | 'full' | Expansion vocabulary. |
OgePanelBarItemClickEvent / OgePanelBarItemExpandingEvent / OgePanelBarItemCollapsingEvent / OgePanelBarItemToggleEvent / OgePanelBarSelectionChangedEvent | interfaces | Payloads: item, key, level and the originating event; the -ing ones carry a mutable cancel, the selection one previousKey. |
[ogePanelBarHeaderTemplate] | OgePanelBarHeaderTemplateContext | Replaces the header layout inside each button ($implicit item, level, expanded, selected) — no focusable controls. |
[ogePanelBarContentTemplate] | OgePanelBarContentTemplateContext | Renders the body of every content item ($implicit item, level), instantiated on first expand. |
OgeExpansionPanel
oge-expansion-panelProperties 16
| Name | Type | Default | Description |
|---|---|---|---|
title | string | '' | Header title. |
subtitle | string | undefined | — | Secondary line under the title. |
icon | string | undefined | — | SVG path data (d) rendered as a 24×24 aria-hidden icon before the title. |
hint | string | undefined | — | Native title tooltip of the header button. |
expanded | boolean | false | Whether the body is shown — two-way. A consumer write applies directly; user and method toggles run expanding / collapsing and the guard first. |
disabled | boolean | false | Blocks toggling; the header stays visible (aria-disabled) but leaves the Tab sequence. |
expandGuard | () => boolean | Promise<boolean> | — | Veto run before every toggle — the accordion's expandGuard: false, a throw or a rejection blocks; while a promise is pending the header shows a spinner and ignores clicks. |
togglePosition | 'start' | 'end' | 'end' | Side of the header the chevron sits on — logical, so RTL mirrors it. |
hideToggle | boolean | undefined | — | Hides the chevron; falls back to the accordion config's hideToggle. |
headingLevel | number | 3 | aria-level of the heading wrapping the header button (native h1–h6 where it can). |
useRegionRole | boolean | true | Gives the body role="region" (APG-optional). |
animation | boolean | number | true | Height animation: true uses the default duration, a number overrides it in milliseconds, false disables it. Suppressed under reduced motion. |
deferRendering | boolean | true | Instantiate an ogeExpansionPanelContent template only on first expand (kept afterwards). Plain projected content is always instantiated. |
stylingMode | 'outlined' | 'filled' | 'flat' | 'outlined' | Visual variant — the accordion's. |
size | 'sm' | 'md' | 'lg' | 'md' | Density of the header row — the accordion's. |
Keyboard & accessibility
| Name | Type | Default | Description |
|---|---|---|---|
APG disclosure | — | — | The title is a <button aria-expanded aria-controls> inside a heading; Enter / Space toggle it natively, the body is role="region" labelled by the header and inert while collapsed. Collapsing a panel that holds focus hands focus back to the header. The pipeline is runOgeExpansionToggle in @oge-ui/behavior, shared with the panel bar. |
Methods 5
| Name | Type | Description |
|---|---|---|
isExpanded() | () => boolean | Whether the panel is expanded — the expanded model’s current value. |
expand() | () => Promise<boolean> | Runs the expand pipeline; resolves whether the panel ended up expanded. |
collapse() | () => Promise<boolean> | Runs the collapse pipeline; resolves whether the panel ended up collapsed. |
toggle() | () => Promise<boolean> | Expands a collapsed panel, collapses an expanded one. |
focus() | () => void | Focuses the header button. |
Events 5
| Name | Type | Description |
|---|---|---|
expanding | OgeExpansionPanelExpandingEvent | Cancelable pre-event of an expand — set cancel = true to keep the panel collapsed. |
collapsing | OgeExpansionPanelCollapsingEvent | Cancelable pre-event of a collapse. |
opened | OgeExpansionPanelToggleEvent | The panel expanded through a user or method toggle — Material's opened, named so it cannot clash with the expanded model. Not fired for a [(expanded)] write. |
closed | OgeExpansionPanelToggleEvent | The panel collapsed through a user or method toggle — Material's closed. |
expandedChange | boolean | The banana half of [(expanded)]. |
Types 4
Types
| Name | Type | Description |
|---|---|---|
OgeExpansionPanelExpandingEvent / OgeExpansionPanelCollapsingEvent | { event?: Event; cancel: boolean } | Cancelable pre-event payloads. |
OgeExpansionPanelToggleEvent | { event?: Event } | Payload of the past-tense events. |
[ogeExpansionPanelActions] | attribute | Marks projected elements as header actions — real buttons rendered beside the toggle. |
[ogeExpansionPanelContent] | OgeExpansionPanelContent | Structural directive marking the body as lazily instantiated (first expand, kept afterwards). |
Accordion configuration
Properties 6
OgeAccordionMessages
| Name | Type | Default | Description |
|---|---|---|---|
invalidSection | string | 'section has errors' | Announced after the title of a panel flagged invalid. |
pending | string | 'working' | Announced while an expandGuard promise is in flight. |
loadingContent | string | 'Loading…' | Shown while a panel's contentLoader is running. |
contentLoadFailed | string | 'Could not load this section.' | Shown when a panel's contentLoader rejected. |
retry | string | 'Retry' | Label of the retry button on a failed content load. |
noData | string | 'No sections to display' | Shown in place of the panels when there are no visible items. |
Types 5
Behavioural defaults
| Name | Type | Description |
|---|---|---|
hideToggle | boolean | undefined | Default for the hideToggle input. |
collapsedHeaderHeight | string | undefined | Default for the collapsedHeaderHeight input. |
expandedHeaderHeight | string | undefined | Default for the expandedHeaderHeight input. Together with the two above this is the MAT_EXPANSION_PANEL_DEFAULT_OPTIONS equivalent. |
| Name | Type | Description |
|---|---|---|
provideOgeAccordionConfig(config) | (config: OgeAccordionConfigInput) => Provider | Application- or component-scoped defaults; shallow-merges messages over the built-ins. |
OGE_ACCORDION_CONFIG | InjectionToken<OgeAccordionConfig> | The token itself, with a factory default — inject it to read the effective config. |