Pip Steps
It is not always desirable to show every selectable value as a pip
on the Slider, and so this option works much in the same way as step
, but it only affects the rendering of the pips and not which values can be selected.
pipstep
default
Here’s some examples of the default pipstep
in action.
Note how the first Slider in this example has pips every 5 values, but the values in-between are still selectable.
Explicity set
In this example we have explicitly set the pipstep
to be 3
, so a pip
will be displayed every 3 values.
Notice how the ending of the Sliders have the pips kind of bunched up, this is because the pipstep
is set to 3
but the max
props are not multiples of 3
.
Extreme values & Labels
Here we’re demonstrating some very extreme max
values that a Slider may encounter. At this extreme it would be unwise (and practically impossible) to show a pip for every value. So we use pipstep
to limit the amount of pips that are shown while still allowing values in-between to be selected.
You could imagine this setup for something like a Home selling website; to restrict the price range the user is looking to buy in.
Special Styling
So far we’ve seen the use of pipstep
to limit how many pips are rendered to the slider. But sometimes we don’t want to only choose to show/hide, but also how to style them differently based on the pip
position on the Slider.
Unique styling can be achieved with css, and the css selector nth-child()
, or targeting the [data-val]
attribute.
See pip styling for examples
Special Formatting
As evident with the “extreme” Slider above, having large numbers such as “1000000” rendered on the Slider is fairly unreadable. And sometimes we don’t even want to show numbers at all. We might want to display a currency symbol, or a percentage, or just strings of text.
Special formatting of labels
can be done using the formatter()
property.
Read more about formatter()