Accordion Blazor API

Accordion Properties

NameTypeDefaultDescription
DataSourceIEnumerable<object>N/ASpecifies the data source to be loaded and displayed within the Accordion component. This property defines the collection of items or structured data that populates each section or panel of the Accordion, enabling dynamic rendering of its contents. The data source can typically be provided as an array of objects, JSON data, or via a remote endpoint depending on configuration.
DisabledboolfalseControls whether the accordion component is enabled or disabled. When set to disabled, all interactive functionality is turned off—users cannot expand, collapse, or interact with any accordion sections. Disabled accordions appear visually inactive to indicate their non-interactive state.
ExpandedIndexesint[]new int[]{}Sets or retrieves the indexes of currently expanded items. By assigning an array of item indexes to this property, you can programmatically expand those specific items. The maximum number of items that can be expanded at once depends on the value specified in the expandMode property (for example, single or multiple expansion modes). When getting this property, it returns an array of the indexes of all expanded items.
ExpandModeAccordionExpandModeAccordionExpandMode.SingleFitHeightSets or retrieves the current expand mode. The expand mode specifies how list or group items behave when expanding or collapsing—such as allowing multiple items to expand simultaneously or restricting expansion to a single item at a time.
UnlockKeystring""Retrieves or assigns the 'unlockKey' property, which serves as the access credential required to unlock and activate the product's full features.
Localestring"en"Sets or retrieves the current language code (e.g., "en", "fr") for the component. This property works together with the messages property to determine which language-specific messages or translations are displayed. Use this to localize your application content based on user preference or locale.
MessagesobjectN/ASpecifies or retrieves an object containing the localized strings used throughout the widget interface. This allows you to define custom translations for various UI elements in different languages. Used together with the locale property to enable localization and internationalization support within the widget.
ReadonlyboolfalseIndicates whether the element is read-only. When set to true, the element cannot be modified or interacted with by users; its value is fixed and user input is disabled. If false, the element remains editable and interactive.
ReorderboolfalseControls whether users can reorder accordion items by dragging and dropping them. When enabled, items within the accordion component can be rearranged interactively; when disabled, the order of items remains fixed.
RightToLeftboolfalseSpecifies or retrieves a value that determines whether the element is aligned to accommodate right-to-left (RTL) languages and scripts, such as Arabic or Hebrew. This property ensures the element’s layout and text direction are properly adjusted to support RTL localization.
Themestring""Specifies the theme to be applied, which controls the overall appearance and visual style of the element, including aspects such as colors, fonts, and background.
UnfocusableboolfalseSpecifies whether the element is capable of receiving keyboard focus, allowing users to navigate to it using the keyboard (such as the Tab key) and interact with it through assistive technologies.

Accordion Methods

NameTypeArgumentsDescription
Collapsevoidint positionCollapses the item located at the specified index, hiding its associated content or details from view. This action typically updates the user interface to indicate that the item is no longer expanded.Args: int position - Index of the item to collapse.
Expandvoidint positionExpands the item located at the specified index in the collection, making its detailed content visible or accessible to the user.Args: int position - Index of the item to expand.
GetDataSourceAsync()Task<IEnumerable<object>>'N/A'Gets the &quot;DataSource&quot; property as Task&lt;IEnumerable&lt;object&gt;&gt;.
Insertvoidint index, object itemInserts a new item into the array at the specified index, shifting existing elements to the right to accommodate the new entry. If the specified index is out of range, the operation will either append the item to the end or return an error, depending on the implementation.Args: int index - Index where the new item will be inserted.,object item - Object representing the new item's properties.
Refreshvoid'N/A'Refreshes the Blazor Component. Performs a layout of the HTML Elements and recalculates the measurements.
RemoveAtvoidint positionRemoves the item located at the specified index from the array, shifting subsequent items one position to the left. The array's length is reduced by one, and the removed item is no longer accessible.Args: int position - Index of the item to remove.
Rendervoid'N/A'Re-renders the Blazor Component. This method will make a full re-render.
SetLocalevoidstring locale, object messagesSets the locale of a component.Args: string locale - The locale abbreviation. For example: 'de'.,object messages - Object containing the locale messages.
SetLocalevoidstring localeSets the locale of a component.
StateHasChangedvoid'N/A'Refreshes the state and Re-renders the Blazor Component, if necessary.
Updatevoidint index, object settingsReplaces the item at the given index in the collection with an updated version, incorporating the specified new property values while preserving any unchanged properties.Args: int index - Index of the item to update.,object settings - Object containing updated property values for the item.

Accordion Events

NameTypeDescriptionEvent Detail
OnCollapseEventCallback<Event>Triggered when an item has completed its collapse animation and is no longer expanded or visible. This event occurs only after the item is fully collapsed, ensuring that any associated transitions or content hiding have finished.dynamic content- The collapsed item's content., int index- The index of the collapsed item., string label- The label of the collapsed item.
Collapsedevent AccordionCollapsedEventHandlerTriggered when an item has completed its collapse animation and is no longer expanded or visible. This event occurs only after the item is fully collapsed, ensuring that any associated transitions or content hiding have finished.AccordionCollapsedEventArgs
OnCollapsingEventCallback<Event>Fires immediately before an item begins its collapse animation, allowing you to perform actions or prevent the collapse from occurring.dynamic content- The item content., int index- The item's index., string label- The item's label.
Collapsingevent AccordionCollapsingEventHandlerFires immediately before an item begins its collapse animation, allowing you to perform actions or prevent the collapse from occurring.AccordionCollapsingEventArgs
OnDragEndEventCallback<Event>Triggered when a user completes a drag-and-drop action to reorder items, indicating that the new order has been finalized and can be processed (e.g., saved or updated in the UI or backend).dynamic position- Current top and left coordinates of the dragged item., dynamic target- The dragged item element., dynamic content- The dragged item's content., int index- The dragged item's index., string label- The dragged item's label.
DragEndedevent AccordionDragEndedEventHandlerTriggered when a user completes a drag-and-drop action to reorder items, indicating that the new order has been finalized and can be processed (e.g., saved or updated in the UI or backend).AccordionDragEndedEventArgs
OnDragStartEventCallback<Event>Fires when the user initiates a drag-and-drop reorder action, signaling the start of an item being moved within a sortable list or container. This event provides an opportunity to perform setup tasks, such as highlighting the item being dragged or preparing the UI for reordering.dynamic position- Initial top and left coordinates of the item being dragged., dynamic target- The item element being dragged., dynamic content- The dragged item's content., int index- The dragged item's index., string label- The dragged item's label.
DragStartedevent AccordionDragStartedEventHandlerFires when the user initiates a drag-and-drop reorder action, signaling the start of an item being moved within a sortable list or container. This event provides an opportunity to perform setup tasks, such as highlighting the item being dragged or preparing the UI for reordering.AccordionDragStartedEventArgs
OnExpandEventCallback<Event>Triggered when an item has completed its expansion and is fully visible to the user. This event occurs after any expansion animations or transitions have finished, ensuring that the item's contents are now accessible for interaction.dynamic position- Current top and left coordinates of the expanded item., dynamic target- The expanded item element., dynamic content- The expanded item's content., int index- The expanded item's index., string label- The expanded item's label.
Expandedevent AccordionExpandedEventHandlerTriggered when an item has completed its expansion and is fully visible to the user. This event occurs after any expansion animations or transitions have finished, ensuring that the item's contents are now accessible for interaction.AccordionExpandedEventArgs
OnExpandingEventCallback<Event>Fires immediately before an item begins its expansion process, allowing you to perform actions or modify data right before the expansion occurs. This event provides an opportunity to prevent the expansion or make adjustments as needed.dynamic content- The content of the item being expanded., int index- The index of the item being expanded., string label- The label of the item being expanded.
Expandingevent AccordionExpandingEventHandlerFires immediately before an item begins its expansion process, allowing you to perform actions or modify data right before the expansion occurs. This event provides an opportunity to prevent the expansion or make adjustments as needed.AccordionExpandingEventArgs

Enums

AccordionExpandMode

AccordionExpandMode.Single
AccordionExpandMode.SingleFitHeight
AccordionExpandMode.Multiple
AccordionExpandMode.Toggle
AccordionExpandMode.None