Close
Angular React Web Components Blazor Blazor
Open Source

Accordion Component

The Ignite UI for Blazor Accordion is a layout component for organizing expandable content panels in a single vertical container.

Live Demo

Anatomy

The accordion structure consists of an accordion container with one or more expansion panel children.

Blazor Accordion anatomy: accordion host and expansion panel structure
1. Header: displays the section title and description and can be clicked to reveal or hide the panel’s content
2. Icon: indicates if the panel is open or closed. Could be placed on the left or on the right side of the header
3. Panel: the section of content linked to an accordion header
igc-accordion                    // host - manages a set of expansion panels
└─ igc-expansion-panel            // child panel
   ├─ [slot="title"]              // panel header title
   ├─ [slot="subtitle"]           // optional header subtitle
   ├─ [slot="indicator"]          // custom collapsed/default indicator
   ├─ [slot="indicator-expanded"] // optional custom expanded-state indicator
   └─ default slot                // expandable panel content

Getting Started

Use the accordion with the Ignite UI for Blazor version installed in your application. Complete the shared Getting Started topic before adding framework-specific imports or registration.

Register the accordion module in Program.cs and add the theme stylesheet to your host page.

builder.Services.AddIgniteUIBlazor(typeof(IgbAccordionModule));
<link href="_content/IgniteUI.Blazor/themes/light/bootstrap.css" rel="stylesheet" />

Usage

Build the accordion by placing one or more IgbExpansionPanel components inside an IgbAccordion container.

Single Expansion

Set SingleExpand to switch between one-open-panel behavior and multiple-open-panel behavior.

<IgbAccordion SingleExpand=true>
  <IgbExpansionPanel>
    <span slot="title">Title Panel 1</span>
    <p>Content Panel 1</p>
  </IgbExpansionPanel>
  <IgbExpansionPanel>
    <span slot="title">Title Panel 2</span>
    <p>Content Panel 2</p>
  </IgbExpansionPanel>
</IgbAccordion>

Programmatic Expansion

Use HideAll and ShowAll to collapse or expand all available panels programmatically.

Calling ShowAll expands all panels, even when SingleExpand is true.

<IgbButton @onclick="ShowAll">Show All</IgbButton>
<IgbButton @onclick="HideAll">Hide All</IgbButton>

<IgbAccordion @ref="accordion">
  <IgbExpansionPanel>
    <span slot="title">Title Panel 1</span>
    <p>Content Panel 1</p>
  </IgbExpansionPanel>
  <IgbExpansionPanel>
    <span slot="title">Title Panel 2</span>
    <p>Content Panel 2</p>
  </IgbExpansionPanel>
</IgbAccordion>

@code {
    private IgbAccordion accordion;

    private async Task ShowAll() => await accordion.ShowAllAsync();

    private async Task HideAll() => await accordion.HideAllAsync();
}

Customize Panel Content

Customize the panel headers and content through the underlying IgbExpansionPanel slots.

<IgbAccordion>
  <IgbExpansionPanel Open>
    <span slot="title">Billing</span>
    <span slot="subtitle">Payment and invoice settings</span>
    <p>Update payment methods, billing contacts, and invoice delivery options.</p>
  </IgbExpansionPanel>
</IgbAccordion>

Nest Accordions

Nest an accordion inside an expansion panel when you need a second level of grouped disclosure.

<IgbAccordion>
  <IgbExpansionPanel Open>
    <span slot="title">Workspace Settings</span>
    <IgbAccordion>
      <IgbExpansionPanel>
        <span slot="title">Notifications</span>
        <p>Configure email and product notification preferences.</p>
      </IgbExpansionPanel>
    </IgbAccordion>
  </IgbExpansionPanel>
</IgbAccordion>

Do/Don’t

When to use: Use the accordion when you need to organize secondary content, FAQ entries, settings groups, or other related vertical sections that users expand on demand. Keep panel titles short and descriptive, and enable single-expansion behavior when users should focus on one section at a time.

When not to use: Use the Expansion Panel when you need a single standalone expandable section instead of a coordinated container that manages multiple panels together. Do not use an accordion to hide essential primary content or to group unrelated sections.

DoDon’t
Blazor Accordion do guidance Blazor Accordion don't guidance

Properties

The accordion exposes container-level controls; panel-specific state is configured on each IgbExpansionPanel.

Name Type Default Description
SingleExpand boolean false Controls whether one or multiple panels can stay expanded at the same time.
Panels ExpansionPanel[] n/a Returns the collection of child expansion panels in the accordion.

Methods

Use the accordion methods when you need to change panel state from your code.

Name Description
ShowAll Expands all available panels.
HideAll Collapses the available panels.

Styling

Style the Blazor accordion with CSS parts and Ignite UI theme variables.

Style the accordion by targeting the parts exposed by its child IgbExpansionPanel components.

Styling Variables

Use Ignite UI for Blazor theme CSS variables as values when styling the expansion panel parts.

Variable What it changes
--ig-secondary-900 Supplies the dark background color used by the panel and header in the example below.
--ig-secondary-900-contrast Supplies a readable foreground color for content on --ig-secondary-900.
--ig-warn-500 Supplies the accent color used by the indicator, title, and subtitle in the example below.
igc-expansion-panel {
  background-color: var(--ig-secondary-900);
  color: var(--ig-secondary-900-contrast);
}

igc-expansion-panel::part(header) {
  background-color: var(--ig-secondary-900);
}

igc-expansion-panel::part(indicator),
igc-expansion-panel::part(title),
igc-expansion-panel::part(subtitle) {
  color: var(--ig-warn-500);
}

CSS Parts

Part What it changes
header The container for the expansion indicator, title, and subtitle.
title The title container.
subtitle The subtitle container.
indicator The indicator container.
content The expansion panel content wrapper.

Styling with Tailwind

Use Tailwind utility classes with CSS part selectors when you want to keep the styling close to the component markup.

Accessibility

The accordion supports keyboard interaction for moving focus between panels and changing their expanded state.

Keyboard Interaction

Use the keyboard shortcuts below to move through the accordion and open or close panels.

Key Action
Down Arrow Moves focus to the panel below.
Up Arrow Moves focus to the panel above.
Alt + Down Arrow Opens the focused panel.
Alt + Up Arrow Closes the focused panel.
Shift + Alt + Down Arrow Opens all enabled panels. If SingleExpand is true, opens only the focused panel.
Shift + Alt + Up Arrow Closes all enabled panels.
Home Moves focus to the first enabled panel.
End Moves focus to the last enabled panel.

Screen Readers / ARIA

The accordion’s accessibility semantics are provided through its child expansion panels and their headers.

  • Each panel header exposes role="button", aria-expanded, and aria-controls.
  • Each panel body exposes role="region" and a label through aria-labelledby or aria-label.
  • Use clear title text for each panel so assistive technologies can announce a meaningful label.
  • Keep interactive content inside panel bodies in a logical tab order.

Accessibility Compliance

Infragistics documents Ignite UI for Blazor accessibility support for Section 508 and WCAG 2.1 guideline areas in the Accessibility Compliance topic. The accordion’s compliance evidence comes from the child IgbExpansionPanel components that provide the interactive headers and regions.

Criterion How the component complies
2.1.1 Keyboard The accordion supports keyboard commands for moving focus and opening or closing panels.
2.4.3 Focus Order Focus moves through enabled panels in sequence, with shortcuts for jumping to the first and last panel.

Your responsibilities:

  • Provide panel titles that describe the content behind each disclosure area.
  • Preserve a logical focus order in the surrounding page layout.
  • Validate any custom styling against your application’s contrast and focus-indicator requirements.

API References

Dependencies

The accordion depends on IgbExpansionPanel for its visible sections.

The accordion also depends on the shared theme stylesheet for its default appearance.

Additional Resources

Use these resources to continue with Ignite UI for Blazor Accordion support, source, and related layout guidance.

  • Expansion Panel - The collapsible section the accordion is built from. See it for configuring individual panels.

FAQ

Should multiple accordion panels be open at the same time?

Allow multiple panels to stay open when users need to compare or cross-reference their content. Use single-expansion behavior when the workflow is clearer with one active section at a time.

When should I avoid using an accordion?

Avoid using an accordion for essential, long, or comparison-heavy content that users need to read at once. Use clear headings, a separate page, or another layout when hiding the content would make it harder to find or compare.

How should I write accordion headers?

Use short, descriptive headers that clearly identify the content revealed by each panel. Users should be able to scan the headers and decide which section to open.

Can an accordion header contain other buttons or links?

Avoid placing other interactive controls inside an accordion header. Keep secondary actions outside the header so the panel trigger remains clear and does not contain nested interactive elements.