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
HoverCard ├── HoverCardTrigger └── HoverCardContent └── HoverCardArrow (optional)
Examples
Avatar Trigger
Loading...
Default
Loading...
Event
Loading...
Link Preview
Loading...
API Reference
HoverCard
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | undefined | — | Unique identifier used to connect the component parts. |
ids | ElementIds | undefined | — | Overrides generated identifiers for individual parts. |
onOpenChange | ((details: OpenChangeDetails) => void) | undefined | — | Runs when open changes. |
openDelay | number | undefined | — | Configures open delay. |
closeDelay | number | undefined | — | Configures close delay. |
disabled | boolean | undefined | false | Disables interaction with the component. |
open | boolean | undefined | — | Whether the component is open when controlled. |
defaultOpen | boolean | undefined | — | Initial open state when uncontrolled. |
positioning | PositioningOptions | undefined | — | Configures floating-element placement and collision handling. |
triggerValue | string | null | undefined | — | Configures trigger value. |
defaultTriggerValue | string | null | undefined | — | Configures default trigger value. |
onTriggerValueChange | ((details: TriggerValueChangeDetails) => void) | undefined | — | Runs when trigger value changes. |
Context, Hooks, and Types
| Export | API |
|---|---|
HoverCardContext | Render-prop component that exposes component state and actions. |
HoverCardRootProvider | Provides an externally created API to the component tree. |
useHoverCard | Creates or accesses the component API. |
useHoverCardContext | Returns the nearest component API. |
HoverCardOpenChangeDetails | Type for the details object passed to the matching change callback. |
Angular
React
Solid
Svelte
Vue