Hover card

A React component in Beamline's Overlays category, in the free sample.

A preview of a person, link or record on hover or keyboard focus, without leaving the page; HoverCardProfile is the standard person preview.

Use it for

  • Previewing a mentioned person, a linked document or a record id.

Not for

  • Essential information or actions (put them on the page).
  • Touch-first screens: they never see it.

Anatomy

  • trigger (a link or button)
  • surface (never wider than the screen)
  • HoverCardProfile: avatar, name, role, about, facts (they wrap in a narrow card)

Variants

  • side: top, right, bottom, left
  • align: start, center, end

States

  • closed
  • opening (400 ms)
  • open
  • loading (HoverCardProfile loading: the profile's shape, the known name at once)
  • closing (200 ms grace)

Keyboard

  • Focus on the trigger opens it
  • Escape closes it

Motion

Grows from the trigger over --pui-motion-in. Opens out of its trigger (_shared/overlay.module.css, source morph): the layer starts as the trigger's own box, offset onto it, and grows; the side next to the trigger is there at once so the nearest rows read within the ruled 90 ms, the far side settles by ~200 ms, content fades in over 90 ms; it closes back into the trigger in 180 ms. Until it has grown the press that opened it cannot land on a row. A profile that is still loading shows its own shape (avatar, name, a line, the facts) and the profile fades in over it when it arrives. Reduced motion: it fades.

Props

PropTypeDefaultDescription
contentReactNode—Content displayed inside the region. Required.
openDelay / closeDelaynumber400 / 200openDelay: ms before it opens on hover; keyboard focus opens it at once. Default 400. closeDelay: ms it stays after the pointer leaves, so the pointer can reach it. Default 200.
side / alignstring"bottom" / "center"side: Edge from which the panel or anchored content opens. Defaults to "bottom". align: Alignment within the available space. Defaults to "center".
HoverCardProfile{ name, role?, avatarSrc?, about?, facts?, status?, loading? }—Person preview for the hover card: name is required; role, avatarSrc, about, facts, status and loading are optional. Omitted content stays hidden.
classNamesHoverCardClassNames / HoverCardProfileClassNames—Classes for the named visual parts; no part overrides by default.
style / refCSSProperties / native Ref—style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default.
children (required)ReactElement<unknown, string | JSXElementConstructor<any>>—What is previewed: a link or button that can take a ref. It keeps its own click.
side"bottom" | "left" | "right" | "top"—Edge from which the panel or anchored content opens. Defaults to "bottom".
align"center" | "end" | "start"—Alignment within the available space. Defaults to "center".
openDelaynumber—ms before it opens on hover; keyboard focus opens it at once. Default 400.
closeDelaynumber—ms it stays after the pointer leaves, so the pointer can reach it. Default 200.
openboolean—Controlled open state; omit to use defaultOpen.
defaultOpenboolean—Initial open state when uncontrolled. Defaults to false.
onOpenChange((open: boolean) => void)—Reports open state after a change; no callback by default.
classNamestring—Classes on the documented visual root; no override by default.
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.
refRef<HTMLDivElement>—Receives the documented root element; no ref by default.
HoverCardProfile.name (required)string—On HoverCardProfile: Person name shown in the profile. Required.
HoverCardProfile.roleReactNode—On HoverCardProfile: Role and team, e.g. "Head of RevOps".
HoverCardProfile.avatarSrcstring—On HoverCardProfile: URL of the avatar image. Defaults to initials instead of a photo.
HoverCardProfile.aboutReactNode—On HoverCardProfile: One or two lines: what they own, where they are.
HoverCardProfile.facts[label: ReactNode, value: ReactNode][]—On HoverCardProfile: Small facts in a row, e.g. [["Deals", "14"], ["Local time", "16:20"]].
HoverCardProfile.status"online" | "offline"—On HoverCardProfile: Presence indicator for the profile; omitted by default to show no presence dot.
HoverCardProfile.loadingboolean—On HoverCardProfile: The person is still being fetched: the card shows the shape of the profile (avatar, name, role, a line, the facts) instead of a spinner, so nothing moves when it arrives; the name, which is known, shows at once.

Built from

Used in

Dependencies

@radix-ui/react-hover-card

Import

import { HoverCard, HoverCardProfile } from "@beamline/hover-card";

Get it

Hover card is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Hover card is included in the free MIT sample. Get Beamline · Connect your agent

More in Overlays

  • Command menu: Search-first list of every action: ranked matching, groups, keycap shortcuts and nested pages; inline as CommandPalette or in a ⌘K dialog as CommandMenu.
  • Toast: Short results of an action stacked at an edge: point at the stack to fan it out and pause the timers; undo or retry in place; Alt+T, Escape and a swipe…
  • Share dialog: Share a document, board or project: invite people by name or email with the access they get, change or remove anyone's access in place, and set who the…
  • Context menu: Actions for an object on right-click, long-press, Shift+F10 or the menu key, opened at the pointer, with the same rows as the dropdown menu.
  • Product tour: A short guided tour over the real interface: a spotlight that glides from one element to the next while the rest of the screen dims, and a card beside…
  • Bottom sheet: A phone panel that rests at a peek and follows the finger to full height; a flick down closes it, and the handle works from the keyboard.
  • Sheet: A panel that slides in from an edge with the page still visible behind it: header and footer stay put while the body scrolls.
  • Dropdown menu: A list of actions behind a trigger, with shortcuts, check items, headings and submenus; one highlight glides under the pointer and jumps with the keyboard.
  • Dialog: A focused task over the page (create, invite, rename) with a title, body and footer; focus moves in, is trapped and returns on close.
  • Alert Dialog: A blocking confirmation that must be answered: the scrim does not dismiss it, focus starts on the safe choice, and an async action keeps it open until…
  • Popover: A small surface anchored to a trigger for a short form, a filter or an explanation; focus moves in and returns on close.
  • Tooltip: Short supporting text for a control: opens after a moment on hover and at once on keyboard focus; inside a toolbar group the next one opens instantly.

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.