Stop Rebuilding UI

Shadcn.io is not affiliated with official shadcn/ui

React useHover Hook

React useHover hook to track mouse hover state on any element. Returns boolean, uses ref, auto-cleanup. TypeScript ready.

Detect hover state on any React element with a single hook. useHover takes a ref and returns true when the mouse is over the element. Uses mouseenter/mouseleave events internally—no CSS required, works with any element type. Auto-cleans up listeners on unmount. Perfect for hover cards, tooltips, interactive buttons, image galleries, or any UI that responds to mouse position. TypeScript generic for element types. SSR safe—only attaches listeners client-side. Works with Next.js App Router and any React framework.

React useHover Hook preview

Scroll to load preview

Installation

FAQ

Was this page helpful?

Sign in to leave feedback.