Search documentation

Search the documentation and open a page.

Displays a preview of content when a user hovers over or focuses a trigger.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/hover-card

Composition

<app-hover-card> ├── [appHoverCardTrigger] └── <app-hover-card-content> └── <app-hover-card-arrow> (optional)

Examples

Avatar Trigger

Loading...

Default

Loading...

Event

Loading...
Loading...

API Reference

<app-hover-card>

Inputs

InputTypeDefaultDescription
idstring | undefinedgeneratedUnique identifier used to connect the hover card parts.
idsPartial<HoverCardElementIds> | undefined—Overrides generated identifiers for individual parts.
openboolean | undefined—Controls whether the hover card is open.
defaultOpenbooleanfalseSets the initial open state when open is uncontrolled.
disabledbooleanfalseDisables interaction with the hover card.
openDelaynumber | undefined—Overrides the delay in milliseconds before opening.
closeDelaynumber | undefined—Overrides the delay in milliseconds before closing.
positioningHoverCardPositioningOptions | undefined—Configures floating-element placement and collision handling.
triggerValuestring | null | undefined—Controls the value of the active trigger.
defaultTriggerValuestring | null | undefined—Sets the initial trigger value when uncontrolled.

Outputs

OutputEvent typeDescription
openChangeboolean | undefinedEmits when the open model changes.
triggerValueChangestring | null | undefinedEmits when the triggerValue model changes.
openChangeDetailsHoverCardOpenChangeDetailsEmits the details for an open-state change.
focusOutsideHoverCardFocusOutsideEventEmits when focus moves outside the hover card.
interactOutsideHoverCardInteractOutsideEventEmits when an interaction occurs outside the hover card.
pointerDownOutsideHoverCardPointerDownOutsideEventEmits when a pointer-down event occurs outside the hover card.
triggerValueChangeDetailsHoverCardTriggerValueChangeDetailsEmits the details for an active-trigger change.

[appHoverCardTrigger]

Apply the directive to the element that opens the hover card.

Inputs

InputTypeDefaultDescription
valuestring | undefined—Identifies the trigger when multiple triggers are used.

<app-hover-card-content>

The content is rendered in a portal and includes the positioner internally.

Inputs

InputTypeDefaultDescription
classstring""Adds classes alongside the component's cn-hover-card-content class.

<app-hover-card-arrow>

Renders the optional arrow and arrow tip. It has no public inputs or outputs.

Context, Providers, and Utilities

ExportAngular API
HoverCardContextStructural directive that exposes the nearest signal-backed API to a template.
HoverCardRootProviderDirective that provides an external API through its required value input.
useHoverCard(options)Creates the signal-backed hover card API inside an Angular injection context.
injectHoverCardContext()Injects the nearest hover card context.
HoverCardImportsReadonly collection containing the wrapper UI and context directives.

Types

ExportDescription
HoverCardApiReactive API exposed by the hover card machine.
HoverCardElementIdsIdentifiers for the hover card parts.
HoverCardPositioningOptionsFloating-element placement and collision options.
HoverCardOpenChangeDetailsDetails emitted when the open state changes.
HoverCardTriggerValueChangeDetailsDetails emitted when the active trigger changes.
HoverCardFocusOutsideEventEvent emitted when focus moves outside.
HoverCardInteractOutsideEventEvent emitted for an interaction outside.
HoverCardPointerDownOutsideEventEvent emitted for a pointer-down interaction outside.
UseHoverCardPropsConfiguration accepted by useHoverCard.
UseHoverCardOptionsAngular context options passed to useHoverCard.
UseHoverCardReturnSignal-backed state, machine service, and hover card API.