Range Slider (noUiSlider)
The Range Slider element allows users to select a single value or a range of values by sliding handles along a track. It's highly customizable and suitable for selecting numeric ranges, like price, age, or percentages.
In BetterForms, this element leverages the noUiSlider
library to provide a touch-friendly and flexible range selection interface.
Common Configuration Properties
type
String
Must be set to "noUiSlider"
.
label
String
The label for the range slider.
model
String
The key in your BetterForms data model where the selected value or array of values (for range) will be stored.
disabled
Boolean
If true
, the slider will be visible but not interactive. Defaults to false
.
readonly
Boolean
If true
, the slider value cannot be changed. Similar to disabled
. Defaults to false
.
hint
String
Additional helper text displayed below the slider.
styleClasses
String
/ Array
CSS classes for styling the wrapper.
noUiSliderOptions
Object
Crucial property. An object containing options for the underlying noUiSlider
component. See examples.
noUiSliderOptions
common settings:
noUiSliderOptions
common settings:start
Number
/ Array
Initial value(s) of the slider. A single number for one handle, an array of two numbers for a range (e.g., [20, 80]
).
range
Object
Defines the slider's min
and max
values. E.g., { 'min': 0, 'max': 100 }
.
connect
Boolean
/ Array
/ String
Highlights the area between handles or from an edge to a handle. true
for a range, [true, false]
for lower connect.
step
Number
The increment/decrement step size.
orientation
String
Orientation of the slider: "horizontal"
(default) or "vertical"
.
tooltips
Boolean
/ Array
/ Object
Whether to show tooltips above the handles. Can be true
, or an array of formatter objects.
format
Object
An object with to
and from
functions for formatting the displayed values (e.g., adding units like '$' or '%').
behaviour
String
User interaction behavior, e.g., 'tap-drag'
, 'drag'
.
pips
Object
Configuration for displaying pips (markers) along the slider.
Example Schema Snippet (Single Value Slider)
Example Schema Snippet (Range Slider)
BetterForms Specific Notes
The
model
will store a single number if one handle is used, or an array of two numbers if two handles (a range) are used.For advanced tooltip formatting or value formatting (like adding currency symbols or units), you'll typically use the
tooltips
(with formatters) orformat
options withinnoUiSliderOptions
. ThewNumb
library is commonly used withnoUiSlider
for number formatting, but it needs to be available in your project.Check the
noUiSlider
documentation for the full extent of customization available throughnoUiSliderOptions
.
Full Property Reference
This element wraps the noUiSlider
library. For a comprehensive list of all noUiSliderOptions
and detailed technical specifications, please refer to:
Last updated
Was this helpful?