In my application, I have implemented a Material UI Slider and I am looking to keep the thumb invisible until the user interacts with it. Once the user changes the slider value, I want the thumb to remain visible at that specific value. By using the CSS property active
, I was able to hide the thumb initially and only show it while the user is actively using the slider by dragging it with their finger or mouse pointer. However, once the interaction stops, the thumb disappears even though the chosen value remains.
The initial state can be seen here: https://i.sstatic.net/KlwYC.png
When the slider is being interacted with (dragged), it looks like this: https://i.sstatic.net/NQzZT.png
After the interaction has finished, the slider appears as shown in this image: https://i.sstatic.net/T87nq.png
I attempted to solve this issue by adding another duplicated slider with a visible thumb component at all times. Then, I tried conditionally rendering one of the sliders based on the value (
value ? <Slider1 /> : <Slider2 />
). However, this solution only partially worked as the thumb always defaulted to the beginning of the slider regardless of the selected value.
Do you have any suggestions or ideas on how I could achieve the desired behavior? Any help would be greatly appreciated. Thank you.
If you need code samples, please refer to the material UI slider API documentation.