Hover Card
Preview content behind a link on hover or keyboard focus.
The design system grew out of the primitives that @alex.morgan published in the component library, and the team keeps refining them as the product surface grows.
Anatomy#
Content is portaled inside an internal positioning wrapper.
Usage#
Use HoverCard to preview the destination of a link on hover or keyboard focus. The trigger defaults to an anchor element, so compose it directly inside prose. Use Tooltip for a brief, non-interactive hint and Popover for content the user must reach and operate.
Delays and anchoring#
openDelay (default 600 ms) keeps the card from opening on a passing pointer, and closeDelay
(default 300 ms) keeps it open while the pointer travels from the trigger into the content. The
card anchors to the line the pointer entered, so it stays attached when the trigger wraps across
multiple lines. placement defaults to 'bottom', and gutter defaults to 4 px.
Dismissal and accessibility#
Escape and a pointer press outside close the card; hover or keyboard focus reopens it. Control the
open state with open and onOpenChange, or start open with defaultOpen. disabled keeps the
card closed. forceMount keeps the content in the DOM while closed.
Hover card content is supplementary: keyboard users cannot reach it and screen readers do not announce it, so it must never be the only place the information lives. Make the same content available at the link destination.
Keyboard interaction#
Moving keyboard focus to the trigger opens the card after openDelay, and blurring the trigger
closes it after closeDelay. Only keyboard (focus-visible) focus opens the card, and touch hover
is ignored. The card itself is not keyboard reachable; keep interactive content in a
Popover instead.
Examples#
Preview a profile inside prose#
Hover or focus the link to preview the author. The trigger wraps across lines like any inline anchor, and the card anchors to the line the pointer entered.
Share one card across multiple triggers#
Mount one hover card instead of one per link. Put a value on each Trigger under one root and
read it from the function children of HoverCard.Content: hovering another trigger moves the same
card to it.
Preview a link destination#
Give a documentation link a small preview with the page title, a description, and the resolved URL. The link wraps across several lines, and the card anchors to the line the pointer entered.
API Reference#
Attributes#
data-closeddata-disableddata-expandeddata-aligndata-instant-motiondata-sideProps#
HoverCard#
Trigger#
Renders a <a> element by default.
Content#
Props for the HoverCard component. Renders a <div> element by default.