react-range
react-range copied to clipboard
How to disable specific thumb in multi-range slider?
I am now using react-range lib to add multi-range slider in my project. And I want to disable the specific thumb instead of the whole layout of range slider. Is it possible to do that?
Found a workaround. I created a function for the Range onChange so that it only updates the values i want.
const [thumb1, setThumb1] = useState(0)
const [thumb2, setThumb2] = useState(10)
function updateValues(values){
setThumb2(values[1])
}
<Range
values={[thumb1, thumb2]}
onChange={(values) => updateValues(values)}
...
/>
This will make it so when you click on the first thumb nothing will happen. Just have to set css on the thumb so that if index == 0 cursor is normal