UI Widgets Slider

A widget that allows a user to select a numeric value within a given range.

Included in: dx.phonejs.js, dx.webappjs.js, dx.all.js
Slider interactive configuration
Copy code
$("#slider").dxSlider({
});

The dxSlider widget allows a user to specify a numeric value within a specified range.

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

  • jQuery
    Use the dxSlider jQuery plug-in.

    HTML
    <div id="slider"></div>
    JavaScript
    $("#slider").dxSlider({
        min: 0,
        max: 100,
        step: 5,
        label: {
            visible: true,
            position: 'bottom'
        }
    });
  • Knockout
    Add a div element and apply the dxSlider binding to this element.

    HTML
    <div data-bind="dxSlider: {
        min: 0,
        max: 100,
        step: 5,
        label: {
            visible: true,
            position: 'bottom'
        }
    }"></div>
  • Angular
    Add a div element and apply the dx-slider directive to this element.

    HTML
    <div dx-slider="{
        min: 0,
        max: 100,
        step: 5,
        label: {
            visible: true,
            position: 'bottom'
        }
    }"></div>

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

You can find detailed information on the principles of working with the widget in the dxSlider section of the Editor Widgets article.

View Demo

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController">
    <div ng-model="currentValue" dx-slider="{
        min: 1,
        max: 99
    }"></div>
    <div class="dx-fieldset">
      <div class="dx-field">
        <div class="dx-field-label">Value</div>
        <div class="dx-field-value">{{currentValue}}</div>
      </div>
    </div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.currentValue = 50;
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
body{
    text-align: center;
}
.dx-slider{
    margin: 10px;
}
<div data-bind="dxSlider: {
    min: 1,
    max: 99,
    value: currentValue
}"></div>
<div class="dx-fieldset">
  <div class="dx-field">
    <div class="dx-field-label">Value</div>
    <div class="dx-field-value" data-bind="text: currentValue"></div>
  </div>
</div>
var myViewModel = {
    currentValue: ko.observable(50)
}
ko.applyBindings(myViewModel);
body{
    text-align: center;
}
.dx-slider{
    margin: 10px;
}
<div id="mySlider"></div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label">Value</div>
        <div class="dx-field-value" id="sliderValue">50</div>
    </div>
</div>
$("#mySlider").dxSlider({
    min: 1,
    max: 99,
    value: 50,
    onValueChanged: function (e) {
        $("#sliderValue").text(e.value);
    }
});
body{
    text-align: center;
}
.dx-slider{
    margin: 10px;
}

Configuration

An object defining configuration options for the dxSlider widget.

Methods

This section describes the members used to manipulate the widget.

Events

This section describes events fired by this widget.