Skip to content
GitHub (opens in a new tab)

HoverCard

A read-only preview card on hover or focus of one trigger, like the passage behind a citation. Fades and rises in.

stableMoleculecontracts/hovercard.json

Preview

HoverCard

A read-only preview of what a trigger points to, on hover or focus. It fades and rises in. Not Tooltip. Not HelpPopover. Not Popover.

Master

Hover or focus the customer. Enter or Space toggles the card; Escape closes it.

NTNorthwind Traders3 open invoices · $2,400 overdue

Usage

Use HoverCard to preview a citation, a mention or a record without leaving the text. Keep it read-only: no buttons, links or fields (use Popover for those). On touch the first tap pins it; the trigger's own click runs on the next tap. CitedAnswer composes it for its marks.

Do's

  • Preview what a mark, mention or link points to without leaving the text
  • Rich read-only content (a title, a site icon, a quoted passage) that is more than HelpPopover's plain sentences
  • Which one: Tooltip names a control; HelpPopover explains it in plain text; HoverCard previews what a trigger points to; Popover holds fields or actions and takes focus.

Don'ts

  • A name on an icon — use Tooltip
  • Help text for a setting — use HelpPopover
  • Links, buttons or fields — use Popover
  • The only place information lives — keep it reachable without hover, e.g. in a list on the page
<HoverCard content={<CustomerCard />}>
  <Button appearance="ghost" mode="neutral" size="sm">Northwind Traders</Button>
</HoverCard>

When to use

  • Preview what a mark, mention or link points to without leaving the text
  • Rich read-only content (a title, a site icon, a quoted passage) that is more than HelpPopover's plain sentences
  • Which one: Tooltip names a control; HelpPopover explains it in plain text; HoverCard previews what a trigger points to; Popover holds fields or actions and takes focus.

When not to use

  • A name on an icon — use Tooltip
  • Help text for a setting — use HelpPopover
  • Links, buttons or fields — use Popover
  • The only place information lives — keep it reachable without hover, e.g. in a list on the page

What an agent reads

import { HoverCard } from "agentic-ds-kit";
must
  • Trigger must be focusable; content stays in the DOM as its description (aria-describedby)
  • Hover after delay; focus shows at once
  • Enter and Space toggle the card instead of activating the trigger
  • Escape, a pointer down outside, or focus moving away closes it; Escape closes only the newest overlay
  • On touch the first tap pins the card open; the trigger's own click runs on the next tap
  • Pointer can move onto the card without it closing (100ms grace)
  • The card fades and rises in; under prefers-reduced-motion it shows and hides with no motion
  • Portal the card to document.body so overflow never clips it
defaults
  • placement top
  • delay 150
  • disabled false
stops if
  • Do not put buttons, links or fields in the card — use Popover
  • Do not make the card the only way to reach its content
  • Do not invent a local HoverCard or preview tooltip
  • Do not use raw hex

From contracts/hovercard.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
contentslotYes—The card body: compose kit text and Avatar. Read-only: no buttons, links or fields. Also rendered hidden as the trigger's description.
childrenslotYes—One focusable trigger. Gets aria-describedby.
placementtop | bottom | left | rightNotopPreferred side. Flips when there is no room and stays inside the viewport.
delaynumberNo150Hover waits; focus, Enter, Space and a tap show at once. Leaving waits 100ms so the pointer can reach the card.
openbooleanNo—Controlled visibility.
onOpenChangefunctionNo—(open) => void, controlled or not.
disabledbooleanNofalseNo card; the trigger still renders.
  • Component
    →

    Tooltip

    Brief supplementary text on hover or focus of a trigger element.

  • Component
    →

    HelpPopover

    Small help panel: optional title plus one to three short sentences.

  • Component
    →

    Popover

    A panel anchored to a trigger.

  • Component
    →

    CitedAnswer

    An assistant reply with inline citation marks that preview their passage in a hover card, and sources folded into one pill with site icons.