Kendo

  • Kendo UI
  • Demos
  • Roadmap
  • Download Beta

Skin

  • Framework
  • UI Widgets
  • Integration

    Configuration Slider API Functions
    • or
    RangeSlider API Functions
    • Description
    • View Code
    • Configuration
    • Methods
    • Events

    The Slider widget provides a rich input for selecting values or ranges of values. Unlike the plain HTML5 range input, the Slider presents a consistent experience across all browsers and has a rich API and event model.

    Getting Started

    There are two basic types of Sliders:
    1. Slider, which presents one thumb and two opposing buttons for selecting a single value
    2. RangeSlider, which present two thumbs for defining a range of values

    Slider

    Create simple HTML input element (type="range" is optional)

     <input id="slider" type="range" />

    Initialize the Slider using a jQuery selector

     $("#slider").kendoSlider();

    RangeSlider

    Create two simple HTML input elements in a div (type="range" is optional)

     <div id="rangeSlider">
         <input type="range" />
         <input type="range" />
     </div>

    Initialize the RangeSlider using a jQuery selector targeting the div

     $("#rangeSlider").kendoRangeSlider();

    The RangeSlider requires two inputs to capture both ends of the value range. This benefits scenarios where JavaScript is disabled, in which case users will be presented with two inputs, still allowing them to input a valid range.

    Customizing Slider Behavior

    Many facets of the Slider and RangeSlider behavior can be configured via simple properties, including:
    • Min/Max values
    • Orientation (horizontal or vertical)
    • Small/Large step
    • Tooltip format/placement

    To see a full list of available properties and values, review the Slider Configuration API documentation tab.

    Customizing Slider default settings

     $("#slider").kendoSlider({
         min:10,
         max:50,
         orientation: "vertical",
         smallStep: 1,
         largeStep: 10
     });
    No code
    slider
    decreaseButtonTitle: String(default: Decrease)
    The title of the decrease button of the slider.
    enabled: Boolean(default: true)
    Can be used to enable/disable the slider.
    increaseButtonTitle: String(default: Increase)
    The title of the increase button of the slider.
    largeStep: Number(default: 5)
    The delta with which the value will change when the user presses the Page Up or Page Down key (the drag handle must be focused). Note that the allied largeStep will also set large tick for every large step.
    max: Number(default: 20)
    The maximum value of the slider.
    min: Number(default: 0)
    The minimum value of the slider.
    orientation: String(default: "horizontal")
    The orientation of the slider. Available options are "horizontal" and "vertical".
    showButtons: Boolean(default: true)
    Can be used to show or hide the slider increase and decrease buttons. The buttons are used to increase or decrease the value. They are not available in the RangeSlider.
    smallStep: Number(default: 1)
    The small step of the slider. The Value will be changed with SmallStep when the end user:
    • clicks on the Slider buttons
    • presses the arrow keys (the drag handle must be focused)
    • drag the drag handle
    tickPlacement: String(default: "both")
    the location of the tick marks in the component. Available options are:
    "topLeft"
    Tick marks are located on the top of the horizontal component or on the left of the vertical component.
    "bottomRight"
    Tick marks are located on the bottom of the horizontal component or on the right side of the vertical component.
    "both"
    Tick marks are located on both sides of the component.
    tooltip: Object
    Confituration of the slider tooltip.
    enabled: Boolean
    Can be used to enable/disable the tooltip.
    format: String
    Can be used to formatting of the text of the tooltip. Note that the applied format will also influence the appearance of the slider tick labels.
    val: Number(default: 0)
    The value of the slider.
    rangeslider
    enabled: Boolean(default: true)
    Can be used to enable/disable the rangeSlider.
    largeStep: Number(default: 5)
    The delta with which the value will change when the user presses the Page Up or Page Down key (the drag handle must be focused). Note that the allied largeStep will also set large ticks for every large step.
    max: Number(default: 20)
    The maximum value of the rangeSlider.
    min: Number(default: 0)
    The minimum value of the rangeSlider.
    orientation: String(default: "horizontal")
    The orientation of the rangeSlider. Available options are "horizontal" and "vertical".
    selectionEnd: Number(default: 10)
    The selection end value of the rangeSlider.
    selectionStart: Number(default: 0)
    The selection start value of the rangeSlider.
    smallStep: Number(default: 1)
    The small step of the rangeSlider. The Value will be changed with SmallStep when the end user:
    • clicks on the Slider buttons
    • presses the arrow keys (the drag handle must be focused)
    • drag the drag handle
    tickPlacement: String(default: "both")
    the location of the tick marks in the component. Available options are:
    "topLeft"
    Tick marks are located on the top of the horizontal component or on the left of the vertical component.
    "bottomRight"
    Tick marks are located on the bottom of the horizontal component or on the right side of the vertical component.
    "both"
    Tick marks are located on both sides of the component.
    tooltip: Object
    Confituration of the Rangelider tooltip.
    enabled: Boolean
    Can be used to enable/disable the tooltip.
    format: String
    Can be used to formatting of the text of the tooltip. Note that the applied format will also influence the appearance of the rangeSlider tick labels.
    slider
    • disable ()
      Disables the slider.

      Example

      var slider = $("#slider").data("kendoSlider");
      // disables the slider
      slider.disable();
    • enable ()
      Enables the slider.

      Example

      var slider = $("#slider").data("kendoSlider");
      // enables the slider
      slider.enable();
    • value (val)
      The value method gets or sets the value of the slider. The value method accepts a {String} or a {Number} as parameters, and returns a {Nubmer}.

      Example

      var slider = $("#slider").data("kendoSlider");
      // Get or sets the value of the slider
      slider.value();

      Parameters

      val
    rangeslider
    • disable ()
      Disables the rangeSlider.

      Example

      var rangeSlider = $("#rangeSlider").data("kendoRangeSlider");
      // disables the rangeSlider
      rangeSlider.disable();
    • enable ()
      Enables the rangeSlider.

      Example

      var rangeSlider = $("#rangeSlider").data("kendoRangeSlider");
      // enables the rangeSlider
      rangeSlider.enable();
    • values ()
      The values method gets or sets the selection start and end of the RangeSlider. The values method accepts {String}, {Number} or {Array} object as parameters, and returns a {Array} object with start and end selection values.

      Example

      var rangeSider = $("#rangeSlider").data("kendoRangeSlider");
      // Get or sets the selection start and end of the rangeSlider
      rangeSlider.values();
    slider
    change
    Fires when the slider value changes as a result of selecting a new value with the drag handle, buttons or keyboard.

    Event data

    value : Number
    Represents the updated value of the slider.
    slide
    Fires when the user drags the drag handle to a new position.

    Event data

    value : Number
    Represents the value from the current position of the drag handle.
    rangeslider
    change
    Fires when the rangeSlider value changes as a result of selecting a new value with one of the drag handles or the keyboard.

    Event data

    values : Number
    Represents the updated array of values of the first and second drag handle.
    slide
    Fires when the user drags the drag handle to a new position.

    Event data

    values : Number
    Represents an array of values of the current positions of the first and second drag handle.
    • Home
    • Kendo UI
    • Demos
    • Roadmap
    • Blogs
    • Forums
    • Documentation
    • FAQ
    • About
    • Follow us on Twitter
    • Subscribe to our RSS feed

    Kendo UI is powered by Telerik

    Copyright © 2011 Telerik Inc. All rights reserved.