Skip to content

Hover Preview Card

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

HoverPreviewCard opens preview content from hover or focus after a delay. Use Popover for click-to-open content.

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.

vue
import './main.css'

Controlled open state

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

vue
<template>
  <Accordion
    :items="items"
    type="multiple"
  />
</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.

vue
<Dialog
  :ui="{
    overlay: 'fixed inset-0 bg-black/50',
    content: 'fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-lg bg-white p-6',
  }"
/>

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.
ariaLabelstring—Adds labelled role="dialog" semantics for interactive previews.
teleportstring | false"body"Teleport target.
uiHoverPreviewCardUi—Classes 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 transitions follow their placement side and last 120ms. Set --akaza-hover-preview-card-duration to change the duration. Reduced-motion mode removes the visible transition.

Positioning Variables

The card and its arrow update together when the trigger, content, or viewport changes size. Placement can switch sides to fit the viewport.

VariableMeaning
--akaza-hover-preview-card-anchor-widthAnchor width in pixels.
--akaza-hover-preview-card-anchor-heightAnchor height in pixels.
--akaza-hover-preview-card-available-widthViewport width after collision padding.
--akaza-hover-preview-card-available-heightViewport height after collision padding.
--akaza-hover-preview-card-transform-originOrigin matching the resolved side and alignment.

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.
Edit this page on GitHub ↗