Slider snap to slider label

0 Answers 96 Views
Slider
Giuseppe
Top achievements
Rank 1
Giuseppe asked on 30 May 2023, 09:58 AM

Hi, 

it is possible to set the snap without buttons on the slider?

i'm trying to avoid something like this

i want to move the cursor with mouse and automatic go to position 0 or 1 or 2 etc... 

i don't want to use buttons and i want to avoid to choose, for example, the value 1,5

it's possibile to do this?

 

Thanks a lot

 

Giuseppe

Petar
Telerik team
commented on 30 May 2023, 10:30 AM

Hi, Giuseppe.

To achieve the targeted functionality, you can use an approach like the one demonstrated in this StackBlitz example. The solution in this example is hidden in the following method and the usage of Math.round:

onChange(event) {
    this.value = Math.round(event.value);
}

Please check the above example and let me know if it demonstrates what you need in your application. 

Regards

Giuseppe
Top achievements
Rank 1
commented on 30 May 2023, 10:53 AM

Hi Petar and thanks for your comment, the solution suggested works fine but i would suggest the dev teams to introduce a prop for configuring this kind of behavior 

Regards

Petar
Telerik team
commented on 31 May 2023, 03:27 AM

Hi, Giuseppe.

I am happy to hear that the suggested approach works for your scenario.

Talking about the built-in property you suggested, thank you for the constructive feedback! Based on your suggestion, we've logged this Feature request on your behalf. Depending on the community's interest in the suggested functionality, we may consider its implementation in the future.

No answers yet. Maybe you can help?

Tags
Slider
Asked by
Giuseppe
Top achievements
Rank 1
Share this question
or