Component
Hover card
A floating card revealed on hover or focus. Project a trigger, place the panel on any side and alignment, tune open/close delays, set its width, and drive it as a controlled overlay.
Profile card
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { HbAvatarImports, HbButtonComponent, HbHoverCardImports } from '@herbst/ui';
const portrait =
'data:image/svg+xml,' +
encodeURIComponent(
"<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'>" +
"<defs><linearGradient id='g' x1='0' y1='0' x2='1' y2='1'>" +
"<stop offset='0' stop-color='#A64B2A'/><stop offset='1' stop-color='#6B7A55'/>" +
'</linearGradient></defs>' +
"<rect width='80' height='80' fill='url(#g)'/></svg>",
);
@Component({
selector: 'hb-demo-hover-card-basic',
imports: [HbHoverCardImports, HbButtonComponent, HbAvatarImports],
template: `
<hb-hover-card>
<button hbHoverCardTrigger hb-button hbType="link">@a.herbst</button>
<hb-hover-card-content>
<div class="flex gap-3">
<hb-avatar [hbSrc]="portrait" hbAlt="A. Herbst" hbFallback="AH" hbSize="lg" />
<div class="space-y-1">
<p class="text-sm font-medium">A. Herbst</p>
<p class="text-sm text-muted-foreground">
Wanders German forests in autumn. Shares falling-leaf photos from the Black Forest.
</p>
<p class="pt-1 text-xs text-muted-foreground">Joined November 2026</p>
</div>
</div>
</hb-hover-card-content>
</hb-hover-card>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HbDemoHoverCardBasicComponent {
protected readonly portrait = portrait;
}
Side, align, offset & width
Controlled, delays & disabled
API reference
hb-hover-card
| Property | Description | Type | Default |
|---|---|---|---|
| [hbSide] | Preferred side of the trigger to open on; flips to the opposite side if space is tight. | 'top' | 'right' | 'bottom' | 'left' | 'bottom' |
| [hbAlign] | Alignment of the panel along the chosen side. | 'start' | 'center' | 'end' | 'center' |
| [hbSideOffset] | Gap in pixels between the trigger and the panel. | number | 4 |
| [hbOpenDelay] / [hbCloseDelay] | Delay in milliseconds before opening on hover and before closing on leave. | number | 700 / 300 |
| [hbOpen] | Controlled open state. Leave undefined for the built-in hover/focus behaviour. | boolean | undefined | undefined |
| (hbOpenChange) | Emits true/false as the card opens and closes. | boolean | — |
| [hbDisabled] | Prevent the card from ever opening. | boolean | false |
Trigger & content
| Property | Description | Type | Default |
|---|---|---|---|
| [hbHoverCardTrigger] | Marks the projected element that opens the card on hover/focus. | directive | — |
| hb-hover-card-content [hbWidth] | Panel width — a number (px) or any CSS length string; null for auto. | number | string | null | null |
| hb-hover-card-content [class] | Extra classes merged over the panel styling. | ClassValue | '' |