Your search did not match any results.

Slider

This demo shows how you can create and configure a Slider.

Backend API
<div class="form"> <div class="dx-fieldset"> <div class="dx-field"> <div class="dx-field-label">Default mode</div> <div class="dx-field-value"> @(Html.DevExtreme().Slider() .Min(0) .Max(100) .Value(90) ) </div> </div> <div class="dx-field custom-height-slider"> <div class="dx-field-label">With labels</div> <div class="dx-field-value"> @(Html.DevExtreme().Slider() .Min(0) .Max(100) .Value(50) .Label(l => l .Visible(true) .Format(new JS("formatLabel")) .Position(VerticalEdge.Top) ) ) </div> </div> <div class="dx-field custom-height-slider"> <div class="dx-field-label">With tooltip</div> <div class="dx-field-value"> @(Html.DevExtreme().Slider() .Min(0) .Max(100) .Value(35) .Tooltip(t => t .Enabled(true) .Format(new JS("formatLabel")) .Position(VerticalEdge.Bottom) .ShowMode(SliderTooltipShowMode.Always) ) ) </div> </div> <div class="dx-field"> <div class="dx-field-label">Without range highlighting</div> <div class="dx-field-value"> @(Html.DevExtreme().Slider() .Min(0) .Max(100) .Value(20) .ShowRange(false) ) </div> </div> <div class="dx-field"> <div class="dx-field-label">With discrete step</div> <div class="dx-field-value"> @(Html.DevExtreme().Slider() .Min(0) .Max(100) .Value(10) .Step(10) .Tooltip(t => t.Enabled(true)) ) </div> </div> <div class="dx-field"> <div class="dx-field-label">Disabled</div> <div class="dx-field-value"> @(Html.DevExtreme().Slider() .Min(0) .Max(100) .Value(50) .Disabled(true) ) </div> </div> </div> <div class="dx-fieldset"> <div class="dx-fieldset-header">Process Value Changes</div> <div class="dx-field"> <div class="dx-field-label">On handle movement</div> <div class="dx-field-value"> @(Html.DevExtreme().Slider() .ID("handler-slider") .Min(0) .Max(100) .Value(10) .OnValueChanged("slider_valueChanged") ) </div> </div> <div class="dx-field"> <div class="dx-field-label">On handle release</div> <div class="dx-field-value"> @(Html.DevExtreme().Slider() .ID("slider-on-handle-move") .Min(0) .Max(100) .Value(10) .ValueChangeMode(SliderValueChangeMode.OnHandleRelease) .OnValueChanged("slider_valueChanged") ) </div> </div> <div class="dx-field"> @(Html.DevExtreme().Slider() .ID("slider-on-handle-release") .Min(0) .Max(100) .Value(10) .OnValueChanged("slider_valueChanged") ) </div> <div class="dx-field"> <div class="dx-field-label">Slider value</div> <div class="dx-field-value"> @(Html.DevExtreme().NumberBox() .ID("slider-value") .Value(10) .Min(0) .Max(100) .ShowSpinButtons(true) .InputAttr("aria-label", "Slider Value") .OnValueChanged("numberBox_valueChanged") ) </div> </div> </div> </div> <script> function formatLabel(value) { return value + "%"; } function slider_valueChanged(data) { $("#slider-value").dxNumberBox("instance").option("value", data.value); } function numberBox_valueChanged(data) { $("#slider-on-handle-move").dxSlider("instance").option("value", data.value); $("#slider-on-handle-release").dxSlider("instance").option("value", data.value); } </script>
using Microsoft.AspNetCore.Mvc; namespace DevExtreme.NETCore.Demos.Controllers { public class SliderController : Controller { public ActionResult Overview() { return View(); } } }
.custom-height-slider { height: 75px; } .dx-field .dx-slider { flex: 1; }

Create a Slider

To create a Slider, declare it in markup and use the min and max properties to limit the range of accepted values.

You can also specify the value property to change the initial value.

The Default mode section shows a Slider with such a basic setup.

Customize Slider Appearance

Max and min labels

The Slider can display labels for the min and max values. To configure the labels, use the label object. In this object, specify the visible, position, and format properties.

Tooltip

To display a handle tooltip, you need to configure the tooltip object:

  • Set the enabled property to true to display a tooltip.

  • Specify the tooltip position: over or under the Slider.

  • Specify the format property.

  • Assign 'onHover' or 'always' to the showMode property to change how the component shows a tooltip.

Range highlight

Use the showRange property to specify if the component should highlight the range between min and value.

Discrete step

Use the step property to specify the value change step for the Slider.

Disabled state

If you want to disable the Slider, set the disabled property to true.

Handle the Value Change Event

Specify the onValueChanged function to handle the value change. In this demo, the NumberBox component and the Sliders use this function to exchange values.

The valueChangeMode property allows you to choose when the Slider changes its value. Available modes include onHandleMove and onHandleRelease. You can see the property's effect in the Process Value Changes section. The first Slider changes its value while a user slides the handle. The second Slider changes its value only after the user releases the handle. These Slider values are synchronized.