Documentation v8.0.38

Preview Downloads Purchase

Overview

noUiSlider is a lightweight range slider with multi-touch support and a ton of features. It supports non-linear ranges, requires no external dependencies, has keyboard support, and it works great in responsive designs. For full documentation please check the plugin's site.

Usage

noUiSlider's CSS and Javascript files are bundled in the global plugin bundles and globally included in all pages:
<link href="assets/plugins/global/plugins.bundle.css" rel="stylesheet" type="text/css"/>
<script src="assets/plugins/global/plugins.bundle.js"></script>

Initialization

  • noUiSlider's CSS is highly customized in sass/vendors/plugins/_nouislider.scssSCSS file in order to use it as native component within the design system. The SCSS code is compiled into assets/plugins/global/plugins.bundle.cssand globally included in all pages.
  • noUiSlider's Javascript is bundled in assets/plugins/global/plugins.bundle.jsand globally included in all pages.

Basic

Basic example of range slider with full touch support:
Min:
Max:
var slider = document.querySelector("#kt_slider_basic");
var valueMin = document.querySelector("#kt_slider_basic_min");
var valueMax = document.querySelector("#kt_slider_basic_max");

noUiSlider.create(slider, {
    start: [20, 80],
    connect: true,
    range: {
        "min": 0,
        "max": 100
    }
});

slider.noUiSlider.on("update", function (values, handle) {
    if (handle) {
        valueMax.innerHTML = values[handle];
    } else {
        valueMin.innerHTML = values[handle];
    }
});
<div class="mb-0">
    <label class="form-label">Example</label>
    <div id="kt_slider_basic"></div>

    <div class="pt-5">
        <div class="fw-bold mb-2">Min: <span id="kt_slider_basic_min"></span></div>
        <div class="fw-bold mb-2">Max: <span id="kt_slider_basic_max"></span></div>
    </div>
</div>

Sizes

Change the sliders default size by applying custom size classes .noUi-smand .noUi-lg:
<div id="kt_slider_sizes_sm" class="noUi-sm"></div>

<div id="kt_slider_sizes_default"></div>

<div id="kt_slider_sizes_lg" class="noUi-lg"></div>

Vertical

Example of horizontal range slider
var slider = document.querySelector("#kt_slider_vertical");

noUiSlider.create(slider, {
    start: [60, 160],
    connect: true,
    orientation: "vertical",
    range: {
        "min": 0,
        "max": 200
    }
});
<div id="kt_slider_vertical"></div>

Tooltip

noUiSlider can provide a basic tooltip using the tooltips option:
var tooltipSlider = document.querySelector("#kt_slider_tooltip");

noUiSlider.create(tooltipSlider, {
    start: [20, 80, 120],
    tooltips: [false, wNumb({decimals: 1}), true],
    range: {
        "min": 0,
        "max": 200
    }
});
<div id="kt_slider_tooltip"></div>

Soft Limits

If you want to disable the edges of a slider, the set event can be used to reset the value if a limit is passed
var slider = document.querySelector("#kt_slider_soft_limits");

noUiSlider.create(slider, {
    start: 50,
    range: {
        min: 0,
        max: 100
    },
    pips: {
        mode: "values",
        values: [20, 80],
        density: 4
    }
});
<div id="kt_slider_soft_limits"></div>

Explore

Metronic Licenses

License FAQs
Regular License
For single end product used by you or one client
$ 39
Extended License
For single SaaS app with paying users
$ 969
Custom License
Reach us for custom license offers.
Buy Now
Learn & Get Inspired

Support at devs.keenthemes.com

Join our developers community to find answer to your question and help others. FAQs
Get Support
Documentation & Videos
From guides and video tutorials, to live demos and code examples to get started.
Plugins & Components
Check out our 300+ in-house components and customized 3rd-party plugins.
Layout Builder
Build your layout, preview it and export the HTML for server side integration.
Metronic Downloads
Download your prefered framework and demo with one click.
What's New
Latest features and improvements added with our users feedback in mind.
Buy now