Values & Binding
Setting the default value(s) for the Slider is done using the value
property or values
property, which accepts a number
or an number[]
array respectively.
The values
property can have any number of values, and the length directly corresponds to the number of handles on the Slider. All values are clamped to the given min
and max
range.
Simple Values
Binding
The value
/values
property can also be bound with the svelte bind:
action.
This allows the Slider to read/write the current value(s) from a variable.
Multiple Values
The values
property can also accept multiple values.
This allows the Slider to have multiple handles.
The values are stored in an array, and the length of the array corresponds to the number of handles on the Slider.
No idea why anyone would ever want 9 handles on their Slider, but it’s totally possible!