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({
});

DevExtreme widgets are integrated with many popular libraries and frameworks. See the Installation section (for JavaScript libraries) or the Prerequisites and Installation section (for ASP.NET MVC framework) to find details on setting up DevExtreme with a particular library or framework.

The following code shows how to create the CheckBox widget using every supported library and framework. For more details on working with widgets in these libraries and frameworks, see the Widget Basics topic for jQuery, Angular, AngularJS, Knockout or ASP.NET MVC.

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>
import { DxCheckBoxModule } from 'devextreme-angular';
// ...
export class AppComponent {
    checkBoxToggled(e) {
        alert(e.value);
    };
}
@NgModule({
    imports: [
        // ...
        DxCheckBoxModule
    ],
    // ...
})
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>

View Demo

See Also
Show Example:
AngularJS
Knockout
jQuery

Configuration

An object defining configuration options for the CheckBox widget.

Methods

This section describes the methods that control the widget.

Events

This section describes events fired by this widget.

See Also