Shadcn Hooks

useHover

A hook to check if the mouse is hovering over an element

Loading...

Installation

npx shadcn@latest add @shadcnhooks/use-hover

API

/**
 * A hook to check if the mouse is hovering over an element
 * @param target - The target to check if the mouse is hovering over
 * @param options - The options for the hook
 * @param options.onEnter - The function to call when the mouse enters the target
 * @param options.onLeave - The function to call when the mouse leaves the target
 * @param options.onChange - The function to call when the mouse enters or leaves the target
 * @returns The boolean value indicating if the mouse is hovering over the target
 */
export function useHover(target: BasicTarget, options?: Options): boolean

Credits

Last updated on

On this page