All docs
V19.2
24.2
The page you are viewing does not exist in version 24.2.
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
19.1
18.2
18.1
The page you are viewing does not exist in version 18.1.
17.2
The page you are viewing does not exist in version 17.2.
A newer version of this page is available. Switch to the current version.

JavaScript/jQuery ButtonGroup Options

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.

buttonComponent

An alias for the buttonTemplate property specified in React. Accepts a custom component. Refer to Using a Custom Component for more information.

buttonRender

An alias for the buttonTemplate property specified in React. Accepts a rendering function. Refer to Using a Rendering Function for more information.

buttonTemplate

Specifies a template for all the buttons in the group.

Type:

template

Template Data:

Object

An object from the items array, extended with the icon and text fields.

Default Name: 'content'

jQuery
index.js
$(function() {
    $("#buttonGroupContainer").dxButtonGroup({
        // ...
        buttonTemplate: function(itemData, $buttonContent) {
            $buttonContent.append(
                // Custom jQuery elements go here
            )
            // ===== or =====
            return /* your markup goes here */
        }
    });
});
Angular
app.component.html
app.module.ts
<dx-button-group ... 
    buttonTemplate="myTemplate">
    <div *dxTemplate="let buttonData of 'myTemplate'">
        <!-- your markup goes here -->
    </div>
</dx-button-group>
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxButtonGroupModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxButtonGroupModule
    ],
    providers: [],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxButtonGroup ...
        button-template="myTemplate">
        <template #myTemplate="{ data }">
            <!-- your markup goes here -->
        </template>
    </DxButtonGroup>
</template>

<script>
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import { DxButtonGroup } from 'devextreme-vue';

export default {
    components: {
        DxButtonGroup
    },
    data() {
        return {
            // ...
        }
    }
}
</script>
React
App.js
import React from 'react';

import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import { ButtonGroup } from 'devextreme-react';

const renderButton = (data) => {
    return (
        {/* your markup goes here */}
    );
}

class App extends React.Component {
    render() {
        return (
            <ButtonGroup ...
                buttonRender={renderButton}
            />
        );
    }
}

export default App;

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
    ],
    // ...
})
Vue
App.vue
<template>
    <DxButtonGroup ...
        :element-attr="buttonGroupAttributes">
    </DxButtonGroup>
</template>

<script>
import DxButtonGroup from 'devextreme-vue/button-group';

export default {
    components: {
        DxButtonGroup
    },
    data() {
        return {
            buttonGroupAttributes: {
                id: 'elementId',
                class: 'class-name'
            }
        }
    }
}
</script>
React
App.js
import React from 'react';

import ButtonGroup from 'devextreme-react/button-group';

class App extends React.Component {
    buttonGroupAttributes = {
        id: 'elementId',
        class: 'class-name'
    }

    render() {
        return (
            <ButtonGroup ...
                elementAttr={this.buttonGroupAttributes}>
            </ButtonGroup>
        );
    }
}
export default App;

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%", "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

itemComponent Deprecated

An alias for the itemTemplate property specified in React. Accepts a custom component. Refer to Using a Custom Component for more information.

itemRender Deprecated

An alias for the itemTemplate property specified in React. Accepts a rendering function. Refer to Using a Rendering Function for more information.

items[]

Configures buttons in the group.

The items array can contain:

  • Objects with fields described in this section
  • Objects with any other fields. In this case, specify the buttonTemplate.

If you need to update the widget items, reassign the entire items[] array as shown in the following example:

JavaScript
buttonGroupInstance.option('items', newItems);
See Also

itemTemplate Deprecated

Use the buttonTemplate property instead.

Specifies a custom button template.

Type:

template

Template Data: undefined

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

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

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

onItemClick

A function that is executed when a button is clicked or tapped.

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.

event

Event (jQuery or EventObject)

The event that caused the function to execute. It is a dxEvent or a jQuery.Event when you use jQuery.

itemData

Object

The clicked button's data.

itemElement

HTMLElement | jQuery

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

itemIndex

Number

The clicked button's index.

model

Object

Model data. Available only if you use Knockout.

Default Value: null

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
model

Object

Model data. Available only if you use Knockout.

fullName

String

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

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.

name

String

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

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
addedItems

Array<any>

The data objects that correspond to the selected buttons.

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

Model data. Available only if you use Knockout.

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 5 Control or a DevExtreme-Based ASP.NET Core 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 5 Control or a DevExtreme-Based ASP.NET Core 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;
    }