import { RefObject } from 'react'; /** * Hook that detects when an element is being hovered over. * * Provides a simple way to track hover state for any HTML element, with support * for both internal ref management and external ref usage. * * @template T - The type of HTML element being monitored (extends HTMLElement) * @param _ref - Optional React ref object for the element to monitor. If not provided, * the hook will create and return its own ref. * * @returns A tuple containing: * - `ref`: React ref object to attach to the target element * - `isHovered`: Boolean indicating whether the element is currently being hovered * * @example * ```tsx * // Using the hook's internal ref * function HoverButton() { * const [ref, isHovered] = useHover(); * * return ( * * ); * } * * // Using an external ref * function HoverDiv() { * const myRef = useRef(null); * const [, isHovered] = useHover(myRef); * * return ( *
* {isHovered && You're hovering!} *
* ); * } * ``` * * @see https://thibault.sh/hooks/use-hover */ declare const useHover: (_ref?: RefObject | null) => [RefObject, boolean]; export { useHover };