Skip to content

Overlays

IHoverCard ​

A preview of what a link points at, shown when the pointer rests on it.

Reviewed by Avery Lang on 12 March.

Which of the three ​

Three components anchor a panel to something on the page, and they are not interchangeable.

Opens onFor
ITooltipHover and focusA short label naming a control
IHoverCardHover and focusA preview: rich, and safe to skip
IPopoverClickContent the reader has to be able to operate

The line that matters is whether anything is lost by never seeing it. A hover card is summoned by hover or focus, so a touch user never gets one — nothing inside it may be the only route to an action or the only copy of a fact. Put a link in it by all means; do not put the only link in it.

Delays ​

openDelay is how long the pointer must rest before the card appears, and closeDelay is the grace period after it leaves. The second one is not padding: it is what lets the pointer travel from the trigger onto the card without the card disappearing under it.

The defaults are 700ms and 300ms. Zero is worth avoiding on anything in a list: every trigger the pointer crosses on its way somewhere else will fire.

Placement ​

side, align and sideOffset work as they do on IPopover, and arrow draws the pointer against the trigger.

Size ​

width and padding match the popover's, and width="none" lets the content size itself — for a preview image, or anything that already knows how wide it is.

Controlling it ​

v-model:open works if you need the state, though a hover card rarely does — it is the one overlay that manages itself.

vue
<script setup lang="ts">
const open = ref(false)
</script>

<template>
  <IHoverCard v-model:open="open">
    …
  </IHoverCard>
</template>

Touch ​

enableTouch opens the card on a tap as well. It is off by default and worth leaving off: a tap has no hover before it, so the card ends up competing with whatever the trigger does when tapped — usually following a link. If the content matters on a phone, it belongs on the page rather than behind a gesture.

Props ​

PropTypeDefaultDescription
openboolean—Controlled open state; use v-model:open
side'top' | 'right' | 'bottom' | 'left''bottom'Which side of the trigger to anchor to
align'start' | 'center' | 'end''center'Alignment along that side
sideOffsetnumber6Gap between trigger and card, in px
arrowbooleanfalseDraw the pointer against the trigger
openDelaynumber700Rest time before opening, in ms
closeDelaynumber300Grace period after leaving, in ms
enableTouchbooleanfalseAlso open on a tap
padding'none' | 'sm' | 'md' | 'lg''md'Inset around the content
width'none' | 'sm' | 'md' | 'lg''md'Card width; none sizes to content
unstyledboolean—Drop built-in classes
classstring—Classes for the card
ui{ content?, arrow? }—Per-element class overrides

Slots ​

SlotDescription
triggerWhat the card hangs off. Rendered as-is — pass a link or a button
defaultThe card's content