/** * The options for the `useScrollTop` hook. */ export interface UseScrollTopOptions { /** * Reference to the target element. * @default window */ target?: Window | Element | null; /** * Defines the threshold value of the vertical scroll position of the target to toggle the visibility. * @default 400 */ threshold?: number; /** * Defines the scrolling behaviour, 'smooth' adds an animation and 'auto' scrolls with a jump. * @default smooth */ behavior?: ScrollBehavior; } /** * The exposes for the `useScrollTop` hook. */ export interface UseScrollTopExposes { /** * Current visible state as a boolean. * @default false */ visible: boolean; /** * Scrolls the target element to the top. */ scrollToTop: () => void; } /** * useScrollTop hook is used to enter input in a certain format such as numeric, date, currency, email and phone. * * @param {UseScrollTopOptions} options - The options for the scroll top behavior. * @returns {UseScrollTopExposes} - The exposed methods for the scroll top behavior. * * @example * ```tsx * const { scrollToTop, visible } = useScrollTop({ * target: elementRef.current, * threshold: 400, * behavior: 'smooth' * }); * * return ( *