Skip to content
Glint UI

HoverCard

A hover-revealed floating surface that displays rich preview content when the pointer rests on an interactive trigger.

Usage

import { HoverCard } from "@glint/components/hover-card.slint";
export component AppWindow inherits Window {
VerticalLayout {
alignment: center;
badge := Rectangle {
width: 120px;
height: 32px;
trigger := TouchArea { }
Text { text: "@glint-ui"; }
}
}
// Give HoverCard the trigger's own geometry and bind active to hover:
card := HoverCard {
x: badge.x;
y: badge.y;
width: badge.width;
height: badge.height;
active: trigger.has-hover;
content-width: 280px;
VerticalLayout {
// preview card content
}
}
}

A HoverCard is an interactive floating surface that displays rich preview information when a user hovers over a trigger element. Unlike Tooltip (which is for brief hints), HoverCard can hold complex layouts and interactive elements.

Give the HoverCard element the trigger’s own position and dimensions (x, y, width, height), and bind active to the trigger’s hover condition (trigger.has-hover).

Examples

Placement sides

side determines which edge of the trigger the card opens from: bottom (the default), top, left, or right.

Alignment

align specifies how the card aligns along the cross-axis of its placement side: start (default), center, or end.

Hover delays

open-delay (default 300ms) prevents accidental opens during quick pointer passes. close-delay (default 300ms) provides ample time for the pointer to move across the gap from the trigger onto the hover card surface.

API Reference

Properties

PropertyTypeDefaultDescription
activein boolno defaultThe hover state that reveals the card — a TouchArea.has-hover, a focus flag, any condition the consumer computes. Glint never owns the trigger (ADR-0006).
open-delayin duration300msHow long active must stay true before the card opens, so incidental hovers never flash it (Radix openDelay, which is 700ms — Glint opens sooner because 700ms reads as the card being broken rather than deliberate, and 300ms already outlasts a pointer crossing the trigger).
close-delayin duration300msGrace period after active drops before the card closes — long enough for the pointer to travel from the trigger onto the card (Radix closeDelay).
content-widthin length280pxWidth of the surface; its height follows the content.
sidein PanelSidePanelSide.bottomWhich edge of the trigger the card opens from — bottom by default, which is where it has always opened. The vocabulary is the Panel's (PanelSide.top, …) because the placement is: only the Panel can measure the surface an upward card has to sit on top of.
alignin PanelAlignPanelAlign.startHow the card lines up along the axis side leaves free. start is the trigger's leading edge, again the placement that was there before.
is-openout boolno defaultTrue while the card is on screen; mirrors PopupWindow.is-open.

Enums

EnumValues
PanelSidetop, right, bottom, left
PanelAlignstart, center, end

Accessibility

  • Hover zone mechanics. The hover zone seamlessly unions the trigger’s bounding box, the gap, and the card surface so the pointer does not lose hover when travelling into the card.
  • Pointer passthrough. While open, clicking the trigger dismisses the card and allows subsequent pointer clicks to reach the trigger control.
  • Dismissable layer. Pressing Escape closes an open hover card and restores focus to whatever control held it.