UNPKG

@supunlakmal/hooks

Version:

A collection of reusable React hooks

14 lines (13 loc) 729 B
import { RefObject } from 'react'; /** * Tracks if an element has been hovered for a minimum specified duration. * Returns a ref to attach to the element and a boolean state. * The state becomes true only after hover persists for `delay` milliseconds. * The state becomes false immediately when hover ends. * * @param delay The minimum hover duration in milliseconds before returning true. * @returns {[RefObject<T | null>, boolean]} A tuple containing: * - hoverRef: Ref to attach to the target element. * - isDelayedHover: Boolean state indicating if hover delay is met. */ export declare function useHoverDelay<T extends HTMLElement = HTMLElement>(delay: number): [RefObject<T | null>, boolean];