Skip to content
GaudiGaudi Design System home

Search documentation

Search every page, heading and paragraph.

useHover

Pointer hover state with props to spread, ignoring touch.

HooksInteraction@gaudi/design-system/hooks/interaction/use-hoverView in StorybookSource

Tracks pointer hover through onPointerEnter and onPointerLeave. Touch pointers are ignored so a tap does not leave an element stuck in its hover state.

Usage

import { useHover } from '@gaudi/design-system/hooks';
const { isHovered, hoverProps } = useHover();
<Card {...hoverProps}>{isHovered ? 'Paused' : 'Playing'}</Card>

Examples

Pause rotating content

Storybook

API

2 options
2 return values

Accessibility

Hover is an enhancement. Anything revealed on hover must also appear on focus (track :focus-within or onFocus) and be reachable on touch.

Notes

  • Use CSS :hover for purely visual effects; use the hook when hover changes behaviour, such as pausing a carousel.