Skip to content
Alea0.1

Overlays

HoverCard

A rich preview on hover or keyboard focus: profiles, link previews, definitions.

Ant Design: Popover trigger="hover"

import { HoverCard } from '@alea/ui';

Examples

Profile preview

Hover or focus the name; move into the card to keep it open.

Built by Ale Vasquez in Caracas.

Props

HoverCard props

A rich preview on hover or keyboard focus, which people can move into (Radix HoverCard, Ant Popover trigger hover).

PropTypeDefaultDescription
childrenrequiredReactNode-The card: a preview of a profile, a page, a definition. Keep it supplementary: the same information must be reachable another way.
triggerrequiredReactNode-The link or element people hover or focus.
closeDelaynumber200ms before it closes after the pointer leaves. Default 200.
openDelaynumber500ms before it opens. Default 500.
placement"start" | "end" | "bottom" | "top"'bottom'top, bottom (default), start or end.

Accessibility

  • Opens on focus as well as hover, and the content is linked as the trigger's description.
  • People can move the pointer into the card; Escape closes it.
  • Keep it supplementary: touch users can't hover.

Keyboard

KeyDoes
TabFocusing the trigger opens it
EscapeCloses it

Do and don't

Do

  • Keep it supplementary: the same information must be reachable by clicking.
  • Delay it (500 ms) so it doesn't pop while the pointer passes.

Don't

  • Don't put actions people need only in a hover card.
  • Don't use it on touch-first screens.
Tested with axe, keyboard and screen reader roles