Convert Figma logo to code with AI

leongersen logonoUiSlider

noUiSlider is a lightweight, ARIA-accessible JavaScript range slider with multi-touch and keyboard support. It is fully GPU animated: no reflows, so it is fast; even on older devices. It also fits wonderfully in responsive designs and has no dependencies.

5,678
659
5,678
32

Top Related Projects

1,019

Tree widget for jQuery

A slider control for Bootstrap 3 & 4.

jQuery only range slider

9,737

Create, read and edit .zip files with Javascript

21,948

:ok_hand: Drag and drop so simple it hurts

An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation, Vue.js)

Quick Overview

noUiSlider is a lightweight JavaScript range slider library with full multi-touch support. It offers a wide range of options and settings, allowing developers to create highly customizable sliders for various applications. The library is framework-agnostic and can be easily integrated into any project.

Pros

  • Lightweight and performant
  • Highly customizable with numerous options
  • Supports touch devices and responsive design
  • Works well with all major browsers

Cons

  • Limited built-in themes or styles
  • Steeper learning curve for advanced customizations
  • Documentation could be more comprehensive
  • Lacks some advanced features found in larger slider libraries

Code Examples

Creating a basic slider:

const slider = document.getElementById('slider');

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

Adding tooltips to the slider:

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

Handling slider events:

slider.noUiSlider.on('update', function (values, handle) {
    console.log('Slider values:', values);
});

Getting Started

  1. Install noUiSlider via npm:

    npm install nouislider
    
  2. Import the library and styles in your project:

    import noUiSlider from 'nouislider';
    import 'nouislider/dist/nouislider.css';
    
  3. Create a container element in your HTML:

    <div id="slider"></div>
    
  4. Initialize the slider in your JavaScript:

    const slider = document.getElementById('slider');
    noUiSlider.create(slider, {
        start: [20, 80],
        connect: true,
        range: {
            'min': 0,
            'max': 100
        }
    });
    
  5. Customize the slider appearance and behavior using the available options and methods provided by the noUiSlider API.

Competitor Comparisons

1,019

Tree widget for jQuery

Pros of jqTree

  • Specialized for creating and managing tree structures
  • Supports drag-and-drop functionality for tree nodes
  • Offers built-in AJAX loading for dynamic tree population

Cons of jqTree

  • Limited to tree-like data structures, less versatile than noUiSlider
  • May have a steeper learning curve for complex tree manipulations
  • Less actively maintained, with fewer recent updates

Code Comparison

noUiSlider:

var slider = document.getElementById('slider');
noUiSlider.create(slider, {
    start: [20, 80],
    connect: true,
    range: {
        'min': 0,
        'max': 100
    }
});

jqTree:

$('#tree1').tree({
    data: data,
    autoOpen: true,
    dragAndDrop: true,
    onCreateLi: function(node, $li) {
        $li.find('.jqtree-element').append('<span class="edit">edit</span>');
    }
});

Summary

While noUiSlider focuses on creating customizable range sliders, jqTree specializes in tree structures. jqTree offers robust tree manipulation features but is less versatile. noUiSlider provides a more general-purpose solution for range selection and is more actively maintained. The choice between them depends on the specific needs of your project - tree structures or range sliders.

A slider control for Bootstrap 3 & 4.

Pros of bootstrap-slider

  • Designed specifically for Bootstrap, ensuring seamless integration with Bootstrap-based projects
  • Supports both horizontal and vertical orientations out of the box
  • Includes built-in support for tooltips and tick marks

Cons of bootstrap-slider

  • Less customizable compared to noUiSlider
  • May have performance issues with a large number of sliders on a single page
  • Limited support for complex range selections

Code Comparison

bootstrap-slider:

$('#ex1').slider({
  formatter: function(value) {
    return 'Current value: ' + value;
  }
});

noUiSlider:

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

Both libraries offer straightforward implementation, but noUiSlider provides more flexibility in range definition and connection options. bootstrap-slider's code is more concise for simple use cases, while noUiSlider's syntax allows for more detailed customization.

jQuery only range slider

Pros of ion.rangeSlider

  • More customizable appearance with built-in skins and themes
  • Supports touch devices and responsive design out of the box
  • Includes additional features like grid of values and ability to use custom steps

Cons of ion.rangeSlider

  • Larger file size and potentially heavier performance impact
  • Requires jQuery as a dependency
  • Less flexible for advanced customizations compared to noUiSlider

Code Comparison

ion.rangeSlider:

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

noUiSlider:

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

Both libraries offer easy-to-use APIs for creating range sliders, but ion.rangeSlider relies on jQuery and offers more built-in options, while noUiSlider is more lightweight and flexible for custom implementations.

9,737

Create, read and edit .zip files with Javascript

Pros of jszip

  • Focuses on file compression and decompression, offering broader functionality
  • Supports various compression methods and file formats
  • Widely used for handling ZIP files in JavaScript applications

Cons of jszip

  • Larger file size due to more comprehensive features
  • May have a steeper learning curve for basic use cases
  • Not optimized for UI-specific tasks like slider creation

Code Comparison

jszip:

var zip = new JSZip();
zip.file("Hello.txt", "Hello World\n");
var img = zip.folder("images");
img.file("smile.gif", imgData, {base64: true});
zip.generateAsync({type:"blob"}).then(function(content) {
    saveAs(content, "example.zip");
});

noUiSlider:

var slider = document.getElementById('slider');
noUiSlider.create(slider, {
    start: [20, 80],
    connect: true,
    range: {
        'min': 0,
        'max': 100
    }
});

Summary

While jszip excels in file compression and manipulation tasks, noUiSlider is specifically designed for creating customizable range sliders. jszip offers more versatility for file-related operations but may be overkill for simple UI components. noUiSlider, on the other hand, provides a focused solution for slider creation with a smaller footprint and easier implementation for its specific use case.

21,948

:ok_hand: Drag and drop so simple it hurts

Pros of Dragula

  • Versatile drag-and-drop functionality for various UI elements
  • Lightweight and easy to integrate into existing projects
  • Supports touch events for mobile devices

Cons of Dragula

  • Limited to drag-and-drop functionality, not suitable for slider-specific features
  • May require additional customization for complex layouts or interactions
  • Less focused on accessibility features compared to noUiSlider

Code Comparison

noUiSlider:

var slider = document.getElementById('slider');
noUiSlider.create(slider, {
    start: [20, 80],
    connect: true,
    range: {
        'min': 0,
        'max': 100
    }
});

Dragula:

dragula([
    document.getElementById('left-container'),
    document.getElementById('right-container')
], {
    revertOnSpill: true
});

Summary

noUiSlider is specifically designed for creating customizable range sliders, offering extensive options for slider behavior and appearance. It excels in creating accessible and responsive slider controls.

Dragula, on the other hand, focuses on providing a flexible drag-and-drop solution for various UI elements. It's more versatile in terms of the types of elements it can handle but lacks the specialized slider functionality of noUiSlider.

Choose noUiSlider for projects requiring advanced slider controls, and Dragula for general drag-and-drop functionality across different UI components.

An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation, Vue.js)

Pros of bootstrap-table

  • Offers a wide range of features for creating and customizing data tables
  • Integrates seamlessly with Bootstrap, providing a consistent look and feel
  • Supports various data sources, including JSON, XML, and server-side processing

Cons of bootstrap-table

  • Larger file size and potentially higher performance overhead
  • Steeper learning curve due to numerous options and configurations
  • May be overkill for simple table needs or projects not using Bootstrap

Code Comparison

bootstrap-table:

<table data-toggle="table" data-url="data.json">
  <thead>
    <tr>
      <th data-field="id">ID</th>
      <th data-field="name">Name</th>
    </tr>
  </thead>
</table>

noUiSlider:

var slider = document.getElementById('slider');
noUiSlider.create(slider, {
    start: [20, 80],
    connect: true,
    range: {
        'min': 0,
        'max': 100
    }
});

While bootstrap-table focuses on creating feature-rich data tables, noUiSlider specializes in range sliders. The code comparison shows the different approaches: bootstrap-table uses HTML markup with data attributes, while noUiSlider relies on JavaScript initialization. Choose bootstrap-table for complex table needs, especially in Bootstrap projects, and noUiSlider for interactive range selection functionality.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

noUiSlider

noUiSlider is a lightweight JavaScript range slider.

  • Accessible with aria and keyboard support
  • GPU animated: no reflows, so fast; even on older devices
  • All modern browsers and IE > 9 are supported
  • No dependencies
  • Fully responsive
  • Multi-touch support on Android, iOS and Windows devices
  • Tons of examples and answered Stack Overflow questions

License

noUiSlider is licensed MIT.

It can be used for free and without any attribution, in any personal or commercial project.

Documentation

An extensive documentation, including examples, options and configuration details, is available here:

noUiSlider documentation.

Contributing

See Contributing.

Sponsorship

noUiSlider is a stable project that still receives a lot of feature requests. A lot of these are interesting, but require a good amount of effort to implement, test and document. Sponsorship of this project will allow me to spend some more of my time on these feature requests.

Please consider sponsoring the project by clicking the "❤ Sponsor" button above. Thanks!

Tooling

Cross-browser testing kindly provided by BrowserStack.

Tested with BrowserStack

NPM DownloadsLast 30 Days