ButtonGroup Blazor API

ButtonGroup Properties

NameTypeDefaultDescription
DataSourceobject[]Determines the buttons configuration. The dataSource can be an array of strings/numbers or objects where the attributes represent the properties of a List Item. For example label, value. It can also be a callback that returns an Array of items as previously described.
SelectionModeButtonGroupSelectionModeButtonGroupSelectionMode.OneDetermines the selection mode for the element.
DisabledboolfalseEnables or disables the element.
Localestring"en"Sets or gets the language. Used in conjunction with the property messages.
MessagesobjectN/ASets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale.
Namestring""Sets or gets the name attribute for the element. Name is used when submiting HTML forms.
ReadonlyboolfalseIf the custom element is readonly, it cannot be interacted with.
RightToLeftboolfalseSets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts.
Themestring""Determines the theme. Theme defines the look of the element
SelectedValuesstring[]new string[]{}Sets or gets the button group's selected values. Represents an array of strings.
SelectedIndexesint[]new int[]{}Sets or gets the button group's selected indexes. Represents an array of numbers
UnfocusableboolfalseIf is set to true, the element cannot be focused.

ButtonGroup Methods

NameTypeArgumentsDescription
GetDataSourceAsync()Task<IEnumerable<object>>'N/A'Gets the &quot;DataSource&quot; property as Task&lt;IEnumerable&lt;object&gt;&gt;.
GetSelectedIndexesAsync()Task<int[]>'N/A'Gets the &quot;SelectedIndexes&quot; property as Task&lt;int[]&gt;.
GetSelectedValuesAsync()Task<string[]>'N/A'Gets the &quot;SelectedValues&quot; property as Task&lt;string[]&gt;.
Refreshvoid'N/A'Refreshes the Blazor Component. Performs a layout of the HTML Elements and recalculates the measurements.
Rendervoid'N/A'Re-renders the Blazor Component. This method will make a full re-render.
Selectvoidobject valueSelects/Unselects an item inside the element.Args: object value - The index or the value of the item to be selected/unselected.
Selectvoidint valueSelects/Unselects an item inside the element.Args: int value - The index or the value of the item to be selected/unselected.
Selectvoidstring valueSelects/Unselects an item inside the element.Args: string value - The index or the value of the item to be selected/unselected.
StateHasChangedvoid'N/A'Refreshes the state and Re-renders the Blazor Component, if necessary.

ButtonGroup Events

NameTypeDescriptionEvent Detail
OnChangeEventCallback<Event>Change event is triggered when the selectedValues/selectedIndexes are changed.N/A
Changedevent ButtonGroupChangedEventHandlerChange event is triggered when the selectedValues/selectedIndexes are changed.ButtonGroupChangedEventArgs

Enums

ButtonGroupSelectionMode

ButtonGroupSelectionMode.None
ButtonGroupSelectionMode.One
ButtonGroupSelectionMode.ZeroOrOne
ButtonGroupSelectionMode.ZeroOrMany