readme.md

August 26, 2026 · View on GitHub

ion.rangeSlider

ion.RangeSlider — flexible and responsive range slider with skins, touch support, and a grid of values.


Features

  • 6 built-in skins (flat, big, modern, round, sharp, square)
  • Single handle or double handle (range) mode
  • Negative and fractional values, custom step
  • Custom values array (numbers or strings)
  • Value grid with snapping
  • Prefix and postfix for displayed values ($100, 100k, etc.)
  • Large number formatting (10000000 → 10 000 000)
  • Reads from and writes to a native <input> element — works in any HTML form
  • Initialization via JavaScript or data-* attributes
  • Public methods: update, reset, destroy
  • Callbacks: onStart, onChange, onFinish, onUpdate
  • Keyboard navigation
  • Touch device support
  • Works in Internet Explorer 8+ and all modern browsers
  • MIT license

ion.rangeSlider

Demos

Dependencies

  • jQuery 1.8+. The browser suite has been run against every version in test/browser/matrix.mjs, from 1.8.3 to 4.0.0 including the 3.x and 4.x slim builds; the boundary versions run on every pull request and the full matrix runs weekly. The plugin's minified files are tested under jQuery 3.7.1 on every pull request.

Install

npm:

npm install ion-rangeslider

Yarn:

yarn add ion-rangeslider

CDN

Use cdnjs or jsDelivr.

<!-- CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.3.2/css/ion.rangeSlider.min.css"/>

<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<!-- Plugin -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.3.2/js/ion.rangeSlider.min.js"></script>

Usage

The slider replaces a native text input:

<input type="text" id="example_id" name="example_name" value="" />

Initialize it with:

$("#example_id").ionRangeSlider();

Full example

$("#example").ionRangeSlider({
    skin: "big",
    min: 0,
    max: 10000,
    from: 1000,
    to: 9000,
    type: 'double',
    prefix: "$",
    grid: true,
    grid_num: 10
});

Or use data-* attributes on the input:

<input type="text" id="example"
    data-min="0"
    data-max="10000"
    data-from="1000"
    data-to="9000"
    data-type="double"
    data-prefix="$"
    data-grid="true"
    data-grid-num="10"
/>

Settings

OptionData-AttrDefaultsTypeDescription
skindata-skinflatstringUI skin (flat, big, modern, round, sharp, square)
typedata-typesinglestringsingle for one handle, double for two handles
mindata-min10numberMinimum value
maxdata-max100numberMaximum value
fromdata-fromminnumberStart position for left handle (or single handle)
todata-tomaxnumberStart position for right handle
stepdata-step1numberStep size. Always > 0. Can be fractional
min_intervaldata-min-interval-numberMinimum range between handles. Double type only
max_intervaldata-max-interval-numberMaximum range between handles. Double type only
drag_intervaldata-drag-intervalfalsebooleanAllow dragging the whole range. Double type only
valuesdata-values[]arrayCustom array of possible values (numbers or strings). When set, min, max and step are ignored
from_fixeddata-from-fixedfalsebooleanFix position of left (or single) handle
from_mindata-from-minminnumberMinimum limit for left (or single) handle
from_maxdata-from-maxmaxnumberMaximum limit for left (or single) handle
from_shadowdata-from-shadowfalsebooleanHighlight the limits for left handle
to_fixeddata-to-fixedfalsebooleanFix position of right handle
to_mindata-to-minminnumberMinimum limit for right handle
to_maxdata-to-maxmaxnumberMaximum limit for right handle
to_shadowdata-to-shadowfalsebooleanHighlight the limits for right handle
prettify_enableddata-prettify-enabledtruebooleanFormat long numbers: 10000000 → 10 000 000
prettify_separatordata-prettify-separator stringSeparator for long numbers: 10000000 → 10,000,000
prettify-nullfunctionCustom formatting function. Receives a number, returns a string (with prettify_all_values, non-numeric values entries are passed too)
prettify_all_valuesdata-prettify-all-valuesfalsebooleanIn values mode, also run prettify on non-numeric entries. Default: false
force_edgesdata-force-edgesfalsebooleanKeep handles and tooltips inside the container
keyboarddata-keyboardtruebooleanKeyboard controls. Left: ←, ↓, A, S. Right: →, ↑, W, D
griddata-gridfalsebooleanShow grid of values above the slider
grid_margindata-grid-margintruebooleanAdd left and right grid gaps
grid_numdata-grid-num4numberNumber of grid units
grid_snapdata-grid-snapfalsebooleanSnap grid to step. When active, grid_num is not used. Max 50 steps
hide_min_maxdata-hide-min-maxfalsebooleanHide min and max labels
hide_from_todata-hide-from-tofalsebooleanHide from and to labels
prefixdata-prefix``stringPrefix for values: **$**100
min_prefixdata-min-prefix``stringPrefix for the minimum value only: From: 0 — 100
max_prefixdata-max-prefix``stringPrefix for the maximum value only: 0 — Up to: 100
postfixdata-postfix``stringPostfix for values: 100k
max_postfixdata-max-postfix``stringPostfix for the maximum value only: 0 — 100**+**
decorate_bothdata-decorate-bothtruebooleanHow to format close values in double mode: $10k — $100k vs $10 — 100k
values_separatordata-values-separatorstringSeparator between from and to labels in double mode
input_values_separatordata-input-values-separator;stringSeparator in the input value for double mode: <input value="25;42">
disabledata-disablefalsebooleanDisable the slider. Input is also disabled and invisible to forms
blockdata-blockfalsebooleanBlock the slider but keep the input enabled. Value is still submitted with the form
extra_classesdata-extra-classesstringExtra CSS classes for the slider container
scope-nullobjectScope for callbacks
onStart-nullfunctionCalled on slider start
onChange-nullfunctionCalled on each value change
onFinish-nullfunctionCalled when the user releases a handle
onUpdate-nullfunctionCalled when slider is modified by update or reset

Callback data

All callbacks receive an object as the first argument:

{
    "input": object,            // jQuery reference to the input
    "slider": object,           // jQuery reference to the slider container
    "min": 1000,                // MIN value
    "max": 100000,              // MAX value
    "from": 10000,              // FROM value
    "from_percent": 10,         // FROM value in percent
    "from_value": 0,            // FROM index in values array (if used)
    "from_min": null,           // FROM minimum limit (null if unset)
    "from_max": null,           // FROM maximum limit (null if unset)
    "to": 90000,                // TO value
    "to_percent": 90,           // TO value in percent
    "to_value": 0,              // TO index in values array (if used)
    "to_min": null,             // TO minimum limit (null if unset)
    "to_max": null,             // TO maximum limit (null if unset)
    "min_pretty": "1 000",      // MIN formatted (if prettify is on)
    "max_pretty": "100 000",    // MAX formatted
    "from_pretty": "10 000",    // FROM formatted
    "to_pretty": "90 000"       // TO formatted
}

Public methods

Save the slider instance, then call methods on it:

// Create
$("#range").ionRangeSlider({
    type: "double",
    min: 0,
    max: 1000,
    from: 200,
    to: 500,
    grid: true
});

// Get the instance
var slider = $("#range").data("ionRangeSlider");

// Update values
slider.update({
    from: 300,
    to: 400
});

// Reset to initial values
slider.reset();

// Remove the slider and restore the original input
slider.destroy();

Advanced examples

Experiments playground on JSFiddle

Update history


Support the project