Tailwind CSS Range Slider Plugin
Build advanced Tailwind CSS range sliders with noUiSlider, including multi-handle ranges, tooltips, pips, formatted values, and JavaScript methods.
Requires Additional Installation
Note that this component requires the use of the third-party noUiSlider plugin.
Requires JS
Note that this component requires the use of our Advanced Range Slider plugin, else you can skip this message if you are already using Preline UI as a package.
Installation
-
Install noUiSlider.
Install
nouislidervia npmTerminalnpm i nouislider -
Add the noUiSLider JavaScript
Include the JavaScript
<script>near the end of your</body>tag:HTML
Disabled slider
Set disabled to true to prevent interaction and show a non-editable slider state.
Range with tooltips
Combine range mode with tooltips to show both handle values while dragging.
Output to HTML element
Use the update event to write the current slider value into another HTML element.
Range output to HTML elements
Use the update event to write the min and max handle values into separate elements.
Formatted values
Format slider output with thousands separators and decimal precision before displaying it.
Output to input
Use the update event to sync the current slider value to an input field.
Certain JavaScript Helpers in Preline UI make use of Lodash plugin. Don't forget to install it, if you haven't done so already: npm i lodash
Range output to inputs
Use the update event to keep two input fields in sync with the range handles.
Certain JavaScript Helpers in Preline UI make use of Lodash plugin. Don't forget to install it, if you haven't done so already: npm i lodash
Range with charts
Use the update event values to drive a highlighted range on the foreground chart.
Requires Additional Installation
Note that this demo requires the use of the third-party Apexcharts plugin and Preline Charts helper.
Certain JavaScript Helpers in Preline UI make use of Lodash plugin. Don't forget to install it, if you haven't done so already: npm i lodash
Range with charts in modal
Use the update event values to drive a highlighted chart range inside a modal.
Requires Additional Installation
Note that this demo requires the use of the third-party Apexcharts plugin and Preline Charts helper.
Certain JavaScript Helpers in Preline UI make use of Lodash plugin. Don't forget to install it, if you haven't done so already: npm i lodash
Destroy and reinitialize
Use the destroy method to remove a slider instance, then initialize it again when you need to restore the behavior.