Components

Hover Preview Card

Hover-triggered rich content preview for links, users, and entities.

HoverPreviewCard opens rich hover/focus content after a delay. Use it for link previews, user cards, repository cards, or entity summaries. If the content needs click-to-open behavior, use Popover instead.

Preview content has no role by default. Add ariaLabel only when content includes interactive controls and needs dialog semantics.

Anatomy

  • #trigger: Element that opens the card on hover/focus. Use triggerProps on custom interactive triggers.
  • #content: Rich preview content.

The root, trigger wrapper, floating content, and optional arrow are generated by the component.

Usage

Hover to open a preview card.

Examples

Custom delay

Use openDelay and closeDelay to tune hover behavior.

<template>
  <HoverPreviewCard :open-delay="300" :close-delay="100">
    <template #trigger>Hover me</template>
    <template #content>Preview</template>
  </HoverPreviewCard>
</template>

Controlled open state

Bind v-model when another interaction should own the card state.

<template>
  <HoverPreviewCard v-model="open">
    <template #trigger>Hover me</template>
    <template #content>Preview</template>
  </HoverPreviewCard>
</template>

Interactive and force-mounted content

Focus may move from trigger into teleported content without closing it. forceMount keeps closed content in DOM with hidden, inert, and closed-state hooks for custom transitions.

<HoverPreviewCard v-model="open" force-mount aria-label="Profile preview">
  <template #trigger="{ triggerProps }">
    <button v-bind="triggerProps">Open profile preview</button>
  </template>
  <template #content="{ close }">
    <a href="/profile">View profile</a>
    <button @click="close()">Close</button>
  </template>
</HoverPreviewCard>

API Reference

Props

PropTypeDefaultDescription
side"top" | "right" | "bottom" | "left""bottom"Preferred side.
align"start" | "center" | "end""center"Alignment on the cross-axis.
sideOffsetnumber8Gap in px.
openDelaynumber600Delay before opening.
closeDelaynumber150Delay before closing.
disabledbooleanfalsePrevents opening.
forceMountbooleanfalseKeeps closed content mounted, hidden, and inert.
openOnClickbooleantrueToggles on touch/pen click. Mouse continues to use hover/focus.
arrowbooleanfalseRenders arrow element.
ariaLabelstringAdds labelled role="dialog" semantics for interactive previews.
teleportstring | false"body"Teleport target.
uiHoverPreviewCardUiClasses for structural parts.

Emits

EventPayloadDescription
open-change(open, details)Fired before open state changes.

Slots

SlotPropsDescription
triggerisOpen, triggerPropsTrigger content.
contentclosePreview content.

UI Options

KeyDescription
rootRoot wrapper.
triggerTrigger wrapper.
contentFloating card.
arrowOptional arrow.

Styling Hooks

UI keyCSS classData attrs
rootakaza-hover-preview-card-rootdata-akaza-state
triggerakaza-hover-preview-card-triggerdata-akaza-state
contentakaza-hover-preview-card-contentdata-akaza-state, data-akaza-side, data-akaza-align, aria-hidden, inert when force-mounted closed, --akaza-hover-preview-card-duration
arrowakaza-hover-preview-card-arrow

Popup entry and exit use a subtle side-aware structural transition. Override --akaza-hover-preview-card-duration to change its 120ms duration. Reduced-motion preference shortens it automatically.

Keyboard

KeyBehavior
Tab / focusOpens on trigger focus and remains open while focus is in trigger or content.
EscapeCloses the card and returns focus to trigger.