Skip to content

Hover Card for Angular

AngularOverlays

A rich, non-modal preview shown while a trigger (usually a link) is hovered or has keyboard focus, meeting WCAG 1.4.13: dismissible with Escape, hoverable, and persistent until pointer and focus leave both trigger and card. The card is inserted right after the trigger and rendered in the top layer, so Tab moves from the trigger into interactive card content; the trigger references it with aria-describedby by default. It never opens on touch and only one hover card is visible at a time.

  • Preview on hoverShows a rich preview for a link or button on hover and keyboard focus.
  • Stays while usedUsers can move the pointer into the card without it closing.
  • Described triggerOptionally links the card to its trigger as a description for screen readers.
  • Tunable delaysShow and hide delays avoid accidental opening while the pointer passes by.

Behavior, design tokens, and limitations are described on the Hover Card page; this page covers the Angular API.

import { Component } from '@angular/core';
import { AuiHoverCard } from '@absoluteui/angular/hover-card';
@Component({
selector: 'app-author',
imports: [AuiHoverCard],
template: `
<a href="/u/ada" [auiHoverCard]="card" hoverCardPlacement="bottom-start" (closed)="closed()">Ada</a>
<ng-template #card>
<p>Ada Lovelace, mathematician.</p>
<a href="/u/ada/posts">Posts</a>
</ng-template>
`,
})
export class AuthorComponent {
closed(): void {}
}
Terminal window
npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/theme

Setup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.

import { AuiHoverCard } from '@absoluteui/angular/hover-card';

Defaults for every instance: provideAbsoluteUIConfig({ components: { hoverCard: { ... } } }) (see Configuration).

Class AuiHoverCard; template reference #ref="auiHoverCard".

AbsoluteUI Hover Card on its trigger: <a href="/u/ada" [auiHoverCard]="card">Ada</a><ng-template #card>...</ng-template>. The template is rendered as an embedded view, so its bindings stay live.

Server rendering: Renders in the browser only; on the server the element stays empty.

Input Type Default Description
auiHoverCard TemplateRef<unknown> Required. The card content: an <ng-template> reference.
hoverCardPlacement Placement 'bottom' Preferred side and logical alignment; flips and shifts to fit.
hoverCardShowDelay number '600' Delay before showing on hover or keyboard focus, ms. 0 shows synchronously.
hoverCardHideDelay number '300' Grace period after the pointer leaves trigger and card before hiding, ms. Always asynchronous, so the pointer can move onto the card.
hoverCardDescribe boolean true The trigger references the card with aria-describedby (added to existing ids). Set false for long or highly interactive cards.
hoverCardDirection "ltr" | "rtl" 'ltr' Resolves logical start/end placements.
Output Payload Description
(opened) null After the card became visible (dispatched on the card element). Re-emits aui-open.
(closed) HoverCardCloseDetail After the card was hidden. ‘programmatic’ covers hide(), destroy(), and another hover card showing. Re-emits aui-close.

Call them through a viewChild query or a template reference.

Method Description
show(): void Show the card now (without the hover delay).
hide(): void Hide the card.

Pattern: Supplementary preview disclosed on hover or keyboard focus, meeting WCAG 1.4.13 Content on Hover or Focus; the card is a generic container in DOM order right after the trigger (not a dialog, not a tooltip).

The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Hover Card: Accessibility and performance.