useMove

Handles move interactions via touch and mouse events.


import { useMove } from 'primereact/hooks';
         

Drag the marker over the element to track the position.

X: 20Y: 60

const { ref, x, y, active, reset } = useMove({ initialValue: { x: 0.2, y: 0.6 } });
         

A horizontal slider implementation by utilizing the x-axis only.

Value: 20

const { ref, x } = useMove({ initialValue: { x: 0.2 } });
         

A vertical slider implementation by utilizing the y-axis only.

Value: 20

const { ref, y } = useMove({ initialValue: { y: 0.2 } });