HoverCard
5 partsA rich, floating card that previews related content when the pointer hovers (or keyboard focus lands) on a trigger, after a short open delay. Built on Popper for collision-aware positioning, with a grace area so the pointer can travel from the trigger to the card without it closing. Use it for sighted-user preview affordances — a user profile on an
Demo
Anatomy
Import the parts and compose them. Each part forwards attributes to its underlying element.
import {
HoverCardRoot,
HoverCardTrigger,
HoverCardPortal,
HoverCardContent,
HoverCardArrow,
} from '@robonen/primitives/overlays/hover-card';
<HoverCardRoot>
<HoverCardTrigger />
<HoverCardPortal />
<HoverCardContent />
<HoverCardArrow />
</HoverCardRoot>API Reference
HoverCardRoot
RootA rich, floating card that previews related content when the pointer hovers (or keyboard focus lands) on a trigger, after a short open delay. Built on Popper for collision-aware positioning, with a grace area so the pointer can travel from the trigger to the card without it closing. Use it for sighted-user preview affordances — a user profile on an
| Prop | Type | Description |
|---|---|---|
open? | boolean | Controlled open state. Bind with v-model:open. |
defaultOpen? | boolean | Initial open state for uncontrolled usage. |
openDelay? | number | Delay (ms) before the content opens after pointer enters trigger. |
closeDelay? | number | Delay (ms) before the content closes after pointer leaves trigger/content. |
| Event | Payload |
|---|---|
update:open | [value: boolean | undefined] |
HoverCardTrigger
TriggerThe element that opens the hover card on pointer enter or focus and anchors the floating content to it. Renders as an `<a>` by default; pass a custom `reference` to position the card against a different element.
No props or events — renders its element and forwards attributes.
HoverCardPortal
PortalTeleports the hover card content into a different part of the DOM (the body by default) so it escapes parent overflow and stacking-context clipping. Wrap the content in it to keep the floating card above the rest of the page.
No props or events — renders its element and forwards attributes.
HoverCardContent
ContentThe floating panel that holds the previewed content. It is positioned against the trigger and is mounted only while the card is open (gated by `Presence`), unless `forceMount` is set so you can drive enter/exit animations yourself.
| Prop | Type | Description |
|---|---|---|
forceMount? | boolean | Keep mounted for CSS exit animations. |
HoverCardArrow
ArrowAn optional arrow that points from the hover card content back toward the trigger. Place it inside `HoverCardContent`; it tracks the resolved side and alignment automatically.
No props or events — renders its element and forwards attributes.