Skip to content

HoverCard

A non-modal floating panel that surfaces a rich preview when the user hovers or focuses a trigger.

  • stable
  • since v0.1.0
  • 3.0 kB
  • overlay
  • preview
  • accessible

Opens on pointer hover and on keyboard focus; content is supplementary — primary info should also be reachable from the trigger.

Preview
Open
tsx

Tune the hover-in and hover-out behaviour with openDelay (default 700 ms) and closeDelay (default 300 ms). Shorter values feel snappier; longer values prevent the card from flickering on accidental hovers.

Preview
Open
tsx

Add HoverCardArrow inside HoverCardContent to render a directional pointer toward the trigger.

Preview
Open
tsx

A typical layout pairs an avatar, name, handle, and a short bio.

Preview
Open
tsx
PropTypeDefaultDescription
side
"top"|"right"|"bottom"|"left"
bottom
Preferred placement.
align
"center"|"start"|"end"
center
Alignment along the side.
sideOffset
number
8
Distance (px) from the trigger.
alignOffset
number
0
Offset (px) along the alignment axis.
collisionPadding
number
8
Viewport padding for collision detection.
container
HTMLElement|(() => HTMLElement)
Portal target — defaults to `document.body`.
withArrow
boolean
true
Render a caret pointing at the trigger. The caret is side-aware and stays aimed at the trigger when the card flips or shifts.
children
ReactNode
Card body.
  • Opens on pointerenter and on keyboard focus, giving keyboard users parity with mouse users.
  • The hover card is non-modal — focus is not trapped and the rest of the page remains interactive.
  • Treat the content as supplementary. Primary actions and identifying information must also live in the trigger so touch users (who never hover) still see them.
  • openDelay and closeDelay adjust the timing of show / hide without affecting accessibility semantics.
  • Use for user profile cards, link previews, footnotes, and definition popovers.
  • Combine with Avatar and Anchor to build a recognisable mention preview.
  • Prefer Tooltip for short text-only hints and Popover for click-triggered content with focusable controls.
  • Anchor it to inline text by wrapping a HoverCardTrigger asChild around the link element itself.