React ButtonGroup Props

This section describes options that configure the ButtonGroup widget's contents, behavior and appearance.

See Also

accessKey

Specifies the shortcut key that sets focus on the widget.

Type:

String

Default Value: null

The value of this option will be passed to the accesskey attribute of the HTML element that underlies the widget.

activeStateEnabled

Specifies whether or not the widget changes its state when interacting with a user.

Type:

Boolean

Default Value: false

This option is used when the widget is displayed on a platform whose guidelines include the active state change for widgets.

disabled

Specifies whether the widget responds to user interaction.

Type:

Boolean

Default Value: false

elementAttr

Specifies the attributes to be attached to the widget's root element.

Type:

Object

Default Value: {}

jQuery
$(function(){
    $("#buttonGroupContainer").dxButtonGroup({
        // ...
        elementAttr: {
            id: "elementId",
            class: "class-name"
        }
    });
});
Angular
HTML
TypeScript
<dx-button-group ...
    [elementAttr]="{ id: 'elementId', class: 'class-name' }">
</dx-button-group>
import { DxButtonGroupModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxButtonGroupModule
    ],
    // ...
})
ASP.NET MVC Control
Razor C#
Razor VB
@(Html.DevExtreme().ButtonGroup()
    .ElementAttr("class", "class-name")
    // ===== or =====
    .ElementAttr(new {
        @id = "elementId",
        @class = "class-name"
    })
    // ===== or =====
    .ElementAttr(new Dictionary<string, object>() {
        { "id", "elementId" },
        { "class", "class-name" }
    })

)
@(Html.DevExtreme().ButtonGroup() _
    .ElementAttr("class", "class-name")
    ' ===== or =====
    .ElementAttr(New With {
        .id = "elementId",
        .class = "class-name"
    })
    ' ===== or =====
    .ElementAttr(New Dictionary(Of String, Object) From {
        { "id", "elementId" },
        { "class", "class-name" }
    })
)

focusStateEnabled

Specifies whether the widget can be focused using keyboard navigation.

Type:

Boolean

Default Value: true

height

Specifies the widget's height.

Type:

Number

|

String

|

Function

Return Value:

Number

|

String

The widget's height.

Default Value: undefined

This option accepts a value of one of the following types:

  • Number
    The height in pixels.

  • String
    A CSS-accepted measurement of height. For example, "55px", "80%", "auto", "inherit".

  • Function
    A function returning either of the above. For example:

    JavaScript
    height: function() {
        return window.innerHeight / 1.5;
    }

hint

Specifies text for a hint that appears when a user pauses on the widget.

Type:

String

Default Value: undefined

hoverStateEnabled

Specifies whether the widget changes its state when a user pauses on it.

Type:

Boolean

Default Value: true

items

Configures buttons in the group.

Objects in this array should contain fields that correspond to the default item template. Refer to Default Templates for more information.

See Also

itemTemplate

Specifies a custom button template.

Type:

template

Template Data:

Object

The current button's data object from the items array.

Default Name: 'item'

See Also

keyExpr

Specifies which data field provides keys used to distinguish between the selected buttons.

Type:

String

|

Function

Default Value: 'text'

onContentReady

A function that is executed when the widget's content is ready and each time the content is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

ButtonGroup

The widget's instance.

element

HTMLElement | jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

model

Object

The model data. Available only when using Knockout.

Default Value: null

onDisposing

A function that is executed before the widget is disposed of.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

ButtonGroup

The widget's instance.

element

HTMLElement | jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

model

Object

The model data. Available only if you use Knockout.

Default Value: null

onInitialized

A function used in JavaScript frameworks to save the widget instance.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

ButtonGroup

The widget's instance.

element

HTMLElement | jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

Default Value: null

See Also

onOptionChanged

A function that is executed after a widget option is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
name

String

The modified option if it belongs to the first level. Otherwise, the first-level option it is nested into.

model

Object

The model data. Available only if you use Knockout.

element

HTMLElement | jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

ButtonGroup

The widget's instance.

fullName

String

The path to the modified option that includes all parent options.

value any

The modified option's new value.

Default Value: null

onSelectionChanged

A function that is executed when a button is selected or selection is canceled.

Type:

Function

Function parameters:
e:

Object

Information about the event that caused the function's execution.

Object structure:
Name Type Description
component

ButtonGroup

The widget's instance.

element

HTMLElement | jQuery

The widget's container. It is an HTML Element or a jQuery Element when you use jQuery.

model

Object

The model data. Available only if you use Knockout.

addedItems

Array<any>

The data objects that correspond to the selected buttons.

removedItems

Array<any>

The data objects that correspond to the buttons whose selection has been canceled.
The objects are taken from the items array.

Default Value: null

rtlEnabled

Switches the widget to a right-to-left representation.

Type:

Boolean

Default Value: false

When this option is set to true, the widget text flows from right to left, and the layout of elements is reversed. To switch the entire application/site to the right-to-left representation, assign true to the rtlEnabled field of the object passed to the DevExpress.config(config) method.

JavaScript
DevExpress.config({
    rtlEnabled: true
});
See Also

selectedItemKeys

Contains the keys of the selected buttons and allows selecting buttons initially.

Type:

Array<any>

Raised Events: onSelectionChanged

The data field that provides the keys can be specified using the keyExpr option.

See Also

selectedItems

Contains the data objects that correspond to the selected buttons. The data objects are taken from the items array.

Type:

Array<any>

Raised Events: onSelectionChanged

selectionMode

Specifies whether a single or multiple buttons can be in the selected state simultaneously.

Type:

String

Default Value: 'single'
Accepted Values: 'multiple' | 'single'

Use the ButtonGroupSelectionMode enum to specify this option when the widget is used as an ASP.NET MVC Control. This enum accepts the following values: Single and Multiple.

stylingMode

Specifies how buttons in the group are styled.

Type:

String

Default Value: 'contained'
Accepted Values: 'text' | 'outlined' | 'contained'

The following styles are available:

Button Styling Modes

View Demo

Use the ButtonStylingMode enum to specify this option when the widget is used as an ASP.NET MVC Control. This enum accepts the following values: Text, Outlined, and Contained.

tabIndex

Specifies the number of the element when the Tab key is used for navigating.

Type:

Number

Default Value: 0

The value of this option will be passed to the tabindex attribute of the HTML element that underlies the widget.

visible

Specifies whether the widget is visible.

Type:

Boolean

Default Value: true

width

Specifies the widget's width.

Type:

Number

|

String

|

Function

Return Value:

Number

|

String

The widget's width.

Default Value: undefined

This option accepts a value of one of the following types:

  • Number
    The width in pixels.

  • String
    A CSS-accepted measurement of width. For example, "55px", "80%", "auto", "inherit".

  • Function
    A function returning either of the above. For example:

    JavaScript
    width: function() {
        return window.innerWidth / 1.5;
    }