UNPKG

@n0n3br/react-use-scroll-direction

Version:

A robust React hook to detect vertical scroll direction ('up', 'down', 'static') for any DOM element or the window.

11 lines (8 loc) 379 B
import React from 'react'; type ScrollDirection = "up" | "down" | "static"; interface UseScrollDirectionOptions { threshold?: number; throttleDelay?: number; } declare function useScrollDirection(ref?: React.RefObject<HTMLElement | null>, options?: UseScrollDirectionOptions): ScrollDirection; export { ScrollDirection, UseScrollDirectionOptions, useScrollDirection };