Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
<app-hover-card> ├── [appHoverCardTrigger] └── <app-hover-card-content> └── <app-hover-card-arrow> (optional)
Examples
Avatar Trigger
Loading...
Default
Loading...
Event
Loading...
Link Preview
Loading...
API Reference
<app-hover-card>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
id | string | undefined | generated | Unique identifier used to connect the hover card parts. |
ids | Partial<HoverCardElementIds> | undefined | — | Overrides generated identifiers for individual parts. |
open | boolean | undefined | — | Controls whether the hover card is open. |
defaultOpen | boolean | false | Sets the initial open state when open is uncontrolled. |
disabled | boolean | false | Disables interaction with the hover card. |
openDelay | number | undefined | — | Overrides the delay in milliseconds before opening. |
closeDelay | number | undefined | — | Overrides the delay in milliseconds before closing. |
positioning | HoverCardPositioningOptions | undefined | — | Configures floating-element placement and collision handling. |
triggerValue | string | null | undefined | — | Controls the value of the active trigger. |
defaultTriggerValue | string | null | undefined | — | Sets the initial trigger value when uncontrolled. |
Outputs
| Output | Event type | Description |
|---|---|---|
openChange | boolean | undefined | Emits when the open model changes. |
triggerValueChange | string | null | undefined | Emits when the triggerValue model changes. |
openChangeDetails | HoverCardOpenChangeDetails | Emits the details for an open-state change. |
focusOutside | HoverCardFocusOutsideEvent | Emits when focus moves outside the hover card. |
interactOutside | HoverCardInteractOutsideEvent | Emits when an interaction occurs outside the hover card. |
pointerDownOutside | HoverCardPointerDownOutsideEvent | Emits when a pointer-down event occurs outside the hover card. |
triggerValueChangeDetails | HoverCardTriggerValueChangeDetails | Emits the details for an active-trigger change. |
[appHoverCardTrigger]
Apply the directive to the element that opens the hover card.
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
value | string | 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
| Input | Type | Default | Description |
|---|---|---|---|
class | string | "" | 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
| Export | Angular API |
|---|---|
HoverCardContext | Structural directive that exposes the nearest signal-backed API to a template. |
HoverCardRootProvider | Directive 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. |
HoverCardImports | Readonly collection containing the wrapper UI and context directives. |
Types
| Export | Description |
|---|---|
HoverCardApi | Reactive API exposed by the hover card machine. |
HoverCardElementIds | Identifiers for the hover card parts. |
HoverCardPositioningOptions | Floating-element placement and collision options. |
HoverCardOpenChangeDetails | Details emitted when the open state changes. |
HoverCardTriggerValueChangeDetails | Details emitted when the active trigger changes. |
HoverCardFocusOutsideEvent | Event emitted when focus moves outside. |
HoverCardInteractOutsideEvent | Event emitted for an interaction outside. |
HoverCardPointerDownOutsideEvent | Event emitted for a pointer-down interaction outside. |
UseHoverCardProps | Configuration accepted by useHoverCard. |
UseHoverCardOptions | Angular context options passed to useHoverCard. |
UseHoverCardReturn | Signal-backed state, machine service, and hover card API. |
Angular
React
Solid
Svelte
Vue