When passing in value, startValue, and endValue, please make sure it is between minRange and maxRange.
When passing in step, please try to ensure that (maxRange - minRange) / step is an integer, and consider the accuracy of each step. The step size is too small may cause the slider unable to slide to the required value quickly, thus affecting the user experience.
When showSteps is enabled, step markers will be displayed on the slider track, suitable for scenarios with clear step selections. The number of steps is determined by (maxRange - minRange) / step + 1.
There are two step marker styles:
Both styles follow the radius property for border radius.
By passing a stepLabels array, the Slider can display custom step labels instead of just handling numeric values. When the slider moves to a step position, the tip will show the corresponding label text instead of the numeric value.
The array length should match the number of steps, which is (maxRange - minRange) / step + 1. For example:
<!-- Speed selector -->
<Slider step={25} showSteps stepLabels={['Very Slow', 'Slow', 'Medium', 'Fast', 'Very Fast']} />
<!-- Percentage selector -->
<Slider step={20} showSteps stepLabels={['0%', '20%', '40%', '60%', '80%', '100%']} />
This makes the Slider suitable for more scenarios, such as volume levels, brightness adjustment, speed selection, rating scales, etc.
The Slider component does not set external margins, please set it yourself when laying out the page.
When passing in Snippet, the area representing the progress of the Slider will render using Snippet, refer to the example.