Skip to content
kitn AI/UI

Hover card

kai-hover-card

Reveals a rich floating panel when its trigger is hovered or focused — a user card behind an avatar, a preview behind a link. The trigger is the default content; the panel goes in slot=“card”.

  • Shadow DOM
  • Hover + focus
  • Auto-flips placement
  • Hover bridge

Put the trigger as the default light-DOM content and the panel in slot="card". The card is portaled and positioned inside the shadow root, with a transparent bridge so the pointer can travel from the trigger into the card without it closing. It opens on hover and on keyboard focus.

Tune the timing with openDelay (default 0) and closeDelay (default 300 ms), and steer the panel with placement — it flips to stay in view regardless.

<kai-hover-card placement="top">
<a href="#">@acme</a>
<div slot="card">
<strong>Acme Corp</strong>
<p>Workspace · 24 members</p>
</div>
</kai-hover-card>

The default slot can be any trigger — here a <kai-avatar> opens a profile card.

Wrap a <kai-badge> to expand a short label into the full story.

Slower to open so it doesn’t fire on every pass — openDelay waits for intent.

The trigger is the default slot; the card is the one named seam:

SlotModePurpose
injectThe rich content shown in the floating hover card.
<kai-hover-card>
<kai-avatar src="/jordan.jpg" alt="Jordan Lee"></kai-avatar>
<div slot="card">
<strong>Jordan Lee</strong>
<p>Staff engineer · Platform</p>
</div>
</kai-hover-card>
PropertyTypeDefaultNotes
openDelayDelay (ms) before the card opens on hover. Defaults to 0 (focus opens it immediately too).
closeDelayDelay (ms) before it closes after the pointer leaves. Defaults to 300.
placementPreferred placement: `'top' | 'bottom' | 'left' | 'right'` (+ optional `-start`/`-end`). Defaults to `'bottom'`; flips to stay in view.
openDrive/observe open state (Shoelace-style: settable + reflected to the `open` attribute, the element still self-manages on hover). Set `el.open = true`, or `<kai-hover-card open>`; listen for `kai-open-change`.
defaultOpenInitial open state on mount (uncontrolled seed).
disabledSuppress the hover behavior entirely without unmounting.

This element wraps these SolidJS components — reach for them directly when you need finer control than the props expose.

HoverCardRootHoverCardTriggerHoverCardContent