🤩 If you like this project, please support us by starring our GitHub repository 🤩
You can control the number of decimal places using the round attribute. Its default value is two. In the example below, we set it to zero:
<tc-range-slider generate-labels="true" round="0"></tc-range-slider>
It can be any positive integer, for example five:
<tc-range-slider generate-labels="true" round="5"></tc-range-slider>
Rounding can also be changed programmatically:
<script>
// get the reference
const $slider = document.getElementById('slider-1');
// set properties
$slider.round = 0;
// or
// $slider.setAttribute('round', '0');
</script>
Or with TypeScript:
<script>
// get the reference
const $slider = document.getElementById('slider-1') as RangeSlider;
// set properties
$slider.round = -200;
// or
// $slider.setAttribute('round', '0');
</script>