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

HoverCard ├── HoverCardTrigger └── HoverCardContent └── HoverCardArrow (optional)

Examples

Avatar Trigger

Loading...

Default

Loading...

Event

Loading...
Loading...

API Reference

HoverCard

PropTypeDefaultDescription
idstring | undefined—Unique identifier used to connect the component parts.
idsElementIds | undefined—Overrides generated identifiers for individual parts.
onOpenChange((details: OpenChangeDetails) => void) | undefined—Runs when open changes.
openDelaynumber | undefined—Configures open delay.
closeDelaynumber | undefined—Configures close delay.
disabledboolean | undefinedfalseDisables interaction with the component.
openboolean | undefined—Whether the component is open when controlled.
defaultOpenboolean | undefined—Initial open state when uncontrolled.
positioningPositioningOptions | undefined—Configures floating-element placement and collision handling.
triggerValuestring | null | undefined—Configures trigger value.
defaultTriggerValuestring | null | undefined—Configures default trigger value.
onTriggerValueChange((details: TriggerValueChangeDetails) => void) | undefined—Runs when trigger value changes.

Context, Hooks, and Types

ExportAPI
HoverCardContextRender-prop component that exposes component state and actions.
HoverCardRootProviderProvides an externally created API to the component tree.
useHoverCardCreates or accesses the component API.
useHoverCardContextReturns the nearest component API.
HoverCardOpenChangeDetailsType for the details object passed to the matching change callback.