Skip to main content
Copy for LLM

Hover Card

A rich popup that appears on hover or focus — designed for previewing content like user profiles, link destinations, or product summaries. Similar to a Tooltip but intended for structured, interactive content.

Basic Usage

User Profile Hover Card

Inline in Running Text

Wrap a word or phrase inside running prose with a hover card to surface a glossary entry, contributor profile, or product reference without the reader leaving the sentence. The trigger renders as an inline <button> styled to look like emphasized body text — fully keyboard-focusable, so the card opens on Tab as well as on hover.

Bold word inside a sentence triggers a profile card

The release notes were authored by after a deep review of the migration plan.

The button keeps font: inherit plus vertical-align: baseline; line-height: inherit; so it sits flush with the surrounding inline text — without the explicit baseline + line-height overrides the browser's default <button> baseline drops the trigger a few pixels and bumps the apparent line-height of the run, making the trigger label and the words after it look subtly larger than the words before. The whole sentence is also kept on a single source line so HTML's whitespace collapsing doesn't surface a double-space between the trigger and the next word.

The button's box is reset property by property: background, border, padding and margin. all: unset would be shorter and would also take away the outline the browser draws on the focused button, which is how a keyboard user sees where they are.

The dotted underline is the conventional cue for a hoverable term in running prose; developers preferring a different affordance (solid underline, accent color) override the inline style attribute.

Pause the cursor over the trigger label for ~300 ms — that's the default delay-show hover-intent buffer — and the profile card animates in below it. Keyboard users can Tab to the button to open it instantly. Lower the buffer with <x-wirekit::hover-card :delay-show="100"> if the example feels sluggish inside a small preview frame.

The panel is teleported out of the document flow via Alpine's x-teleport, into WireKit's overlay landmark near the end of <body>, so the dialog's <div> markup lifts out of the surrounding <p> before the browser parses it — this keeps the running paragraph well-formed and the Alpine $refs.panel lookup intact across the teleport boundary. The landmark is created by WireKit's own JavaScript, so a teleported panel stays inside a region an assistive technology can announce.

Placement

Control where the card appears relative to the trigger:

Top placement

Available placements: 'top', 'bottom' (default), 'left', 'right', and their -start/-end variants (e.g. 'bottom-start'). The card automatically flips if there isn't enough space, powered by Floating UI. A card placed left or right that fits on neither side, as on most phones, opens below or above the trigger instead.

Custom Delays

Adjust show/hide delays for different use cases:

{{-- Quick preview: short delay --}}
<x-wirekit::hover-card :delay-show="100" :delay-hide="100">
    <x-slot:trigger>Quick preview</x-slot:trigger>
    Fast-appearing content.
</x-wirekit::hover-card>

{{-- Slow reveal: longer delay --}}
<x-wirekit::hover-card :delay-show="500" :delay-hide="300">
    <x-slot:trigger>Slow reveal</x-slot:trigger>
    Content that takes longer to appear.
</x-wirekit::hover-card>

Content That Loads on Open

A closed hover card still carries its content in the page, so a list with a card in every row sends every card along. Load the content when the card opens instead: the card raises wirekit:hover-card-opened once per opening, and the event rises from the card to its ancestors, so a listener on the card or on its row hears it.

<x-wirekit::hover-card x-on:wirekit:hover-card-opened="$wire.loadPreview({{ $product->id }})">
    <x-slot:trigger>{{ $product->name }}</x-slot:trigger>
    @if($previewId === $product->id)
        <x-wirekit::text size="sm">{{ $preview }}</x-wirekit::text>
    @else
        <x-wirekit::skeleton.text :lines="2" />
    @endif
</x-wirekit::hover-card>

Building the Card When It Is Needed

A hover card builds its card with the page, and the card starts its script, though a list with a card in every row shows few of them. With lazy, a hover card keeps its card in a <template> until it first shows. Once built, the card stays when it hides again, and it shows, takes the focus and hides as a card built with the page does. The content still renders with the page; to load it only when the card opens, see Content That Loads on Open.

{{-- 1. The card is built the first time it shows --}}
<x-wirekit::hover-card lazy>
    <x-slot:trigger>Ada Lovelace</x-slot:trigger>

    {{-- 2. The card's content --}}
    <x-wirekit::text size="sm">Mathematician, wrote the first published program.</x-wirekit::text>
</x-wirekit::hover-card>

To build every hover card this way, set it once in the components array of config/wirekit.php:

// config/wirekit.php
'components' => [
    'hover-card' => ['lazy' => true],
],

Until a hover card has shown, its card is not part of the page: a script that looks for something inside it, and a browser test that reads it before the card shows, find nothing. Show the card first, or leave lazy off for a card whose content something has to find while it is hidden.

Hover Card vs Tooltip

Feature Tooltip Hover Card
Content Plain text Rich HTML (images, buttons, links)
Interaction Read-only Can contain interactive elements
ARIA role tooltip dialog
Keyboard Focus shows, no interaction inside Focus shows, can Tab into content
Use case Short labels, abbreviations User profiles, link previews

Props

Prop Type Default Description
placement string 'bottom' Floating UI placement ('top', 'bottom', 'left', 'right', + -start/-end)
offset int 8 Distance from trigger in pixels
delayShow int 300 Milliseconds before showing on hover
delayHide int 200 Milliseconds before hiding on leave
lazy bool false Keep the card out of the page until it first shows. components.hover-card.lazy in config/wirekit.php sets the default. See Building the Card When It Is Needed
scope string|null null Scoped personalization key

Slots

Slot Purpose
trigger The element that activates the hover card
default Rich content inside the card panel

Accessibility

  • An aria-label or aria-labelledby of yours names the card
  • Trigger has aria-haspopup="dialog" — announces that activation opens a dialog
  • Trigger has aria-expanded — toggles between "true" and "false"
  • Panel uses role="dialog" — screen readers announce content as dialog
  • Keyboard: focus on the trigger opens the card, Tab moves into its content, and Escape closes it and returns focus to the trigger
  • Mouse: hovering trigger or panel keeps card open; moving away starts hide delay
  • Card stays open when hovering between trigger and panel (bridge delay prevents flicker)
  • SPA-safe: cleans up on Livewire page navigation

Keyboard Interaction

Key Action
Tab (focusing the trigger) Open the hover card
Tab (trigger focused, card holds buttons or links) Move into the card, onto its first control
Tab (trigger focused, card is read-only) Move to the next control on the page; the card closes behind you
Tab (on the card's last control) Move to the control that follows the trigger; the card closes
Shift + Tab (on the card's first control) Move back to the trigger; the card closes
Escape Close the card, and return focus to the trigger when it was inside the card. Works wherever focus is, and a modal or a drawer around the card stays open

The card's panel is rendered at the end of the document so it can position itself freely over the page, which means the browser's own tab order would send you past it rather than into it. The component bridges that: the sequence above is what you get, whatever the panel's position in the markup.

Pitfalls

  • Don't put critical info in a hover-card. Hover has no keyboard or touch equivalent — the component reveals on focus too, but discoverability for non-mouse users is poor. For must-read content use <x-wirekit::popover> with an explicit trigger.
  • Don't auto-open on page load. Hover-cards are user-triggered.

Design Tokens

Element Token
Panel background --color-wk-bg-elevated
Panel border --color-wk-border / --border-wk-width
Panel radius --radius-wk-lg
Panel shadow --shadow-wk-lg
Panel padding --padding-wk-x-md
Text color --color-wk-text
Text size --text-wk-md
Font family --font-wk-sans
Transition --transition-wk-duration

Customization

This component reads no config/wirekit.php keys — every option is a prop. Style it through the design tokens above, or scope a variant with the scope prop.

An empty 'hover-card' => [] block in the config is not an override point: pasting one changes nothing.

Further Reading

Updated in WireKit v2.74.0 (2026-11-24)

Was this page helpful?

Thank you for your feedback!

Voting requires cookies or local storage. What we store