Hover Card
Rich preview that opens when a link or trigger is hovered or focused. Delays, sides and alignment.
Installation
pnpm dlx nachui add hover-cardAnatomy
The card opens after
openDelay when the pointer enters the trigger and closes after closeDelay when it leaves, unless it moved onto the card. Keyboard focus opens it at once and blur closes it. Escape closes it too. Touch pointers never open it, so on phones the trigger keeps its own behaviour.Composition
Variants
Default
A profile card on a mention.
Link preview
Inline in a paragraph, opening above and aligned to the start of the link.
The incident started after the
rolled out to the EU region, and was resolved by rolling back the pooling change.API Reference
HoverCard
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | - | Controlled open state |
defaultOpen | boolean | false | Initial state when uncontrolled |
onOpenChange | (open: boolean) => void | - | Called when the state changes |
openDelay | number | 500 | Milliseconds of hover before opening |
closeDelay | number | 200 | Milliseconds after leaving before closing |
HoverCard.Trigger
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Attach the handlers to the child instead of a span |
HoverCard.Content
| Prop | Type | Default | Description |
|---|---|---|---|
side | "top" | "bottom" | "left" | "right" | "bottom" | Placement relative to the trigger |
align | "start" | "center" | "end" | "center" | Alignment along that side |
sideOffset | number | 4 | Gap from the trigger in pixels |
className | string | - | Additional CSS classes |
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.