An accordion component that displays collapsible content panels with only one or multiple panels expanded at a time. RadzenAccordion organizes content into expandable sections, saving vertical space while keeping all content accessible. Ideal for FAQs, settings panels, grouped content, or any scenario where showing all content at once would be overwhelming. Features single/multiple expand control, optional icons in panel headers, programmatic control via SelectedIndex two-way binding, Expand and Collapse event callbacks, keyboard navigation (Arrow keys, Space/Enter, Home/End), and disabled item support. By default, only one panel can be expanded at a time (Multiple = false). Set Multiple = true to allow multiple panels to be expanded simultaneously.
IComponent
IHandleEvent
IHandleAfterRender
RadzenComponent.OnAfterRenderAsync
RadzenComponent.RaiseContextMenu
RadzenComponent.RaiseMouseEnter
RadzenComponent.AddContextMenu
RadzenComponent.RaiseMouseLeave
RadzenComponent.OnBecameInvisible
RadzenComponent.DefaultCulture
RadzenComponent.IsJSRuntimeAvailable
ComponentBase.OnInitializedAsync
ComponentBase.OnParametersSet
ComponentBase.OnParametersSetAsync
ComponentBase.StateHasChanged
ComponentBase.ShouldRender
ComponentBase.OnAfterRender
ComponentBase.InvokeAsync
ComponentBase.DispatchExceptionAsync
ComponentBase.RendererInfo
ComponentBase.Assets
ComponentBase.AssignedRenderMode
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class RadzenAccordion : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRenderBasic accordion (single expand mode):
<RadzenAccordion>
<Items>
<RadzenAccordionItem Text="Personal Information" Icon="person">
Name, email, address fields...
</RadzenAccordionItem>
<RadzenAccordionItem Text="Account Settings" Icon="settings">
Password, preferences, notifications...
</RadzenAccordionItem>
<RadzenAccordionItem Text="Billing" Icon="payment">
Payment methods, invoices...
</RadzenAccordionItem>
</Items>
</RadzenAccordion>
Accordion with multiple expand and events:
<RadzenAccordion Multiple="true" Expand=@OnExpand Collapse=@OnCollapse>
<Items>
<RadzenAccordionItem Text="FAQ 1" Selected="true">Answer 1</RadzenAccordionItem>
<RadzenAccordionItem Text="FAQ 2">Answer 2</RadzenAccordionItem>
</Items>
</RadzenAccordion>An accordion component that displays collapsible content panels with only one or multiple panels expanded at a time. RadzenAccordion organizes content into expandable sections, saving vertical space while keeping all content accessible. Ideal for FAQs, settings panels, grouped content, or any scenario where showing all content at once would be overwhelming. Features single/multiple expand control, optional icons in panel headers, programmatic control via SelectedIndex two-way binding, Expand and Collapse event callbacks, keyboard navigation (Arrow keys, Space/Enter, Home/End), and disabled item support. By default, only one panel can be expanded at a time (Multiple = false). Set Multiple = true to allow multiple panels to be expanded simultaneously.
public RadzenAccordion()Gets the collection of RadzenAccordionItem components that belong to this accordion.
public IReadOnlyList<RadzenAccordionItem> AccordionItems { get; }
| Type | Description |
|---|---|
| IReadOnlyList<RadzenAccordionItem> | Gets the collection of RadzenAccordionItem components that belong to this accordion. |
Gets or sets the callback invoked when an accordion item is collapsed. Receives the index of the collapsed item as a parameter.
public EventCallback<int> Collapse { get; set; }
| Type | Description |
|---|---|
| EventCallback<int> | Gets or sets the callback invoked when an accordion item is collapsed. Receives the index of the collapsed item as a parameter. |
Gets or sets the callback invoked when an accordion item is expanded. Receives the index of the expanded item as a parameter.
public EventCallback<int> Expand { get; set; }
| Type | Description |
|---|---|
| EventCallback<int> | Gets or sets the callback invoked when an accordion item is expanded. Receives the index of the expanded item as a parameter. |
Gets or sets the render fragment containing RadzenAccordionItem components that define the accordion panels. Each RadzenAccordionItem represents one expandable panel with its header and content.
public RenderFragment Items { get; set; }
| Type | Description |
|---|---|
| RenderFragment | Gets or sets the render fragment containing RadzenAccordionItem components that define the accordion panels. Each RadzenAccordionItem represents one expandable panel with its header and content. |
Gets or sets whether multiple accordion items can be expanded simultaneously. When false (default), expanding one item automatically collapses others. When true, users can expand multiple items independently.
public bool Multiple { get; set; }
| Type | Description |
|---|---|
| bool | Gets or sets whether multiple accordion items can be expanded simultaneously. When false (default), expanding one item automatically collapses others. When true, users can expand multiple items independently. |
Gets or sets the zero-based index of the currently expanded item. Use with @bind-SelectedIndex for two-way binding to programmatically control which item is expanded. In multiple expand mode, this represents the last expanded item.
public int SelectedIndex { get; set; }
| Type | Description |
|---|---|
| int | Gets or sets the zero-based index of the currently expanded item. Use with @bind-SelectedIndex for two-way binding to programmatically control which item is expanded. In multiple expand mode, this represents the last expanded item. |
Gets or sets the callback invoked when the selected index changes. Used for two-way binding with @bind-SelectedIndex.
public EventCallback<int> SelectedIndexChanged { get; set; }
| Type | Description |
|---|---|
| EventCallback<int> | Gets or sets the callback invoked when the selected index changes. Used for two-way binding with @bind-SelectedIndex. |
Adds the item.
public void AddItem(RadzenAccordionItem item)
| Type | Name | Description |
|---|---|---|
| RadzenAccordionItem | item | The item. |
protected override void BuildRenderTree(Rendering.RenderTreeBuilder __builder)
| Type | Name | Description |
|---|---|---|
| Rendering.RenderTreeBuilder | __builder |
Collapses all accordion items.
public Task CollapseAll()
| Type | Description |
|---|---|
| Task |
Expands all accordion items.
public Task ExpandAll()
| Type | Description |
|---|---|
| Task |
protected override string GetComponentCssClass()
| Type | Description |
|---|---|
| string |
Determines whether the specified index is selected.
protected bool IsSelected(int index, RadzenAccordionItem item)
| Type | Name | Description |
|---|---|---|
| int | index | The index. |
| RadzenAccordionItem | item | The item. |
| Type | Description |
|---|---|
| bool | true if the specified index is selected; otherwise, false. |
Gets the item's aria-label attribute value.
protected string ItemAriaLabel(int index, RadzenAccordionItem item)
| Type | Name | Description |
|---|---|---|
| int | index | The index. |
| RadzenAccordionItem | item | The item. |
| Type | Description |
|---|---|
| string | The item's collapse or expand aria-label value depending on if the item is expanded or collapsed. If the relevant aria-label is null or whitespace this method returns "Expand" or "Collapse". |
Gets the item's title attribute value.
protected string ItemTitle(int index, RadzenAccordionItem item)
| Type | Name | Description |
|---|---|---|
| int | index | The index. |
| RadzenAccordionItem | item | The item. |
| Type | Description |
|---|---|
| string | The item's collapse or expand title value depending on if the item is expanded or collapsed. If the relevant title is null or whitespace this method returns "Expand" or "Collapse". |
Removes the item.
public void RemoveItem(RadzenAccordionItem item)
| Type | Name | Description |
|---|---|---|
| RadzenAccordionItem | item | The item. |
public override Task SetParametersAsync(ParameterView parameters)
| Type | Name | Description |
|---|---|---|
| ParameterView | parameters |
| Type | Description |
|---|---|
| Task |