CheckBox

The CheckBox is a small box, which when selected by the end user, shows that a particular feature has been enabled or a specific option has been chosen.

Included in: dx.mobile.js, dx.web.js, dx.viz-web.js, dx.all.js
Module: ui/check_box
Export: default
CheckBox interactive configuration
Copy Code
Copy to Codepen
$("#checkbox").dxCheckBox({
});

You can create the widget using one of the following approaches.

jQuery
JavaScript
HTML
$(function () {
    $("#checkBox").dxCheckBox({
        text: 'Toggle me',
        value: undefined,
        onValueChanged: function (e) {
            alert(e.value);
        }
    });
});
<div id="checkBox"></div>
Angular
HTML
TypeScript
<dx-check-box
    text="Toggle me"
    [value]="undefined"
    (onValueChanged)="checkBoxToggled($event)">
</dx-check-box>
export class AppComponent {
    checkBoxToggled(e) {
        alert(e.value);
    };
}
AngularJS
HTML
JavaScript
<div ng-controller="DemoController">
    <div dx-check-box="{
        text: 'Toggle me',
        value: undefined,
        onValueChanged: checkBoxToggled
    }"></div>
</div>
angular.module('DemoApp', ['dx'])
    .controller("DemoController", function ($scope) {
        $scope.checkBoxToggled = function (e) {
            alert(e.value);
        };
    });
Knockout
HTML
<div data-bind="dxCheckBox: {
    text: 'Toggle me',
    value: undefined,
    onValueChanged: function (e) {
        alert(e.value);
    }
}"></div>
ASP.NET MVC Controls
Razor C#
Razor VB
@(Html.DevExtreme().CheckBox()
    .ID("checkBox")
    .Text("Toggle me")
    .OnValueChanged(@<text>
        function (e) {
            alert(e.value);
        }
    </text>)
)
@(Html.DevExtreme().CheckBox() _
    .ID("checkBox") _
    .Text("Toggle me") _
    .OnValueChanged("checkBox_valueChanged")
)
<script>
    function checkBox_valueChanged(e) {
        alert(e.value);
    }
</script>

Note that DevExtreme widgets require you to link the jQuery library to your application. If you use the Knockout or AngularJS approach, the Knockout or AngularJS library is also required. For detailed information on linking these libraries to your project, refer to the topics in the Installation section.

View Demo

See Also
Show Example:
AngularJS
Knockout
jQuery

Configuration

An object defining configuration options for the CheckBox widget.

Methods

This section describes the members used to manipulate the widget.

Events

This section describes events fired by this widget.

See Also