react-slider
react-slider copied to clipboard
fix: marks calculation when boolean or number is passed
Hi, I have found that marks
property does not work correctly when min
is not zero. You can open demo page and adjust the min
property of "Slider with marks" example. In that case all marks are out of tracks. Of course I can calculate numbers by myself and pass an array of numbers but I think it is a good adjustment.
Also added tests for marks
prop and covered marks logic by checking key
property.
Try with adjusting the step
property to match the min
value of the Slider. This will ensure that the marks are aligned with the track. Additionally, consider using the included
property to determine if the marks should be displayed inside or outside the track.
@msf-caesar Why do you think that displaying marks outside is an expected behavior? For me it seems that marks should be inside the track and it should be the default behavior. If user wants to display them outside he would pass an array of numbers:
<ReactSlider
min={10}
max={20}
marks={[-10, 0, 10, 20]}
/>
I don't want to overcomplicate this logic with additional prop included
.
Would love to see this get merged