ui-kit0.0

Overlays

Hover card

Preview a person or link on hover.

Usage

A rich preview of a link, shown on hover or keyboard focus. Compose HoverCard, a HoverCardTrigger (an <a>) and HoverCardContent. It opens after 700ms and closes 300ms after the pointer has left both the link and the card, so you can move onto the card.

Release notes for 2.4 were written by @adalovelace and reviewed by the design systems group.

When to use

  • Extra context for a mention or link: a profile, a repository, a document.
  • Only content that is also reachable by following the link. The card never opens on touch.

Not for: anything the person must act on (use a popover), or short labels (use a tooltip).

API

HoverCard

PropTypeDefaultDescription
openboolean—Controlled open state.
defaultOpenbooleanfalseInitial state when uncontrolled.
onOpenChange(open: boolean) => void—Called when the card asks to open or close.
openDelaynumber700Hover time before it opens, ms.
closeDelaynumber300Time after leaving trigger and card before it closes, ms.

HoverCardContent

PropTypeDefaultDescription
placement'bottom' | 'top' | … (+ '-start' | '-end')'bottom'Preferred side; flips when there is no room.
offsetnumber8Gap to the trigger, px.
arrowbooleanfalseDraw an arrow pointing at the trigger.

HoverCardTrigger takes asChild to use your own link, such as a Next.js Link.

Keyboard

KeyAction
Tab to the linkOpens the card straight away (no delay for keyboard focus).
TabMoves into the card when it holds links or buttons; leaving it closes the card.
EscCloses the card.

Accessibility

  • The card is supplementary: the trigger is a real link and must work without it.
  • Keyboard focus on the link opens it; touch never does.
  • Interactive content inside the card is reachable with Tab because the card follows the link in the DOM.

Motion

  • Open: pops from the trigger side, 6px travel, scale .96 (220ms, ease-out). Close: 160ms fade.
  • Reduced motion: it appears and disappears without movement.