Use cases
- User profile preview — hover over a username to see a profile card with bio, role, and avatar.
- Link preview — preview the destination of a link before navigating.
- Detail tooltip — show richer content than a standard tooltip (multiple lines, structured data).
When NOT to use
- Touch-only interfaces — hover is not available on mobile. Use a tap-to-reveal pattern instead.
- Critical information — anything the user must see. Hover content is easily missed.
- Interactive content inside the card — if the card contains buttons/links, prefer
Popoverwith click trigger.
Key props
| Prop | Type | Description |
|---|---|---|
timing | 'instant' | 'fast' | 'normal' | 'slow' | Delay preset for open/close timing. |
openDelay | number | Milliseconds before the card appears (default 700). |
closeDelay | number | Milliseconds before the card hides (default 300). |
open / defaultOpen | boolean | Controlled or uncontrolled visibility. |
onOpenChange | (open: boolean) => void | Observe/control visibility changes. |
size | 'sm' | 'md' | 'lg' | 'auto' | Width preset for HoverCardContent. |
variant | 'default' | 'soft' | 'outline' | 'elevated' | 'plain' | Content surface style. |
padding | 'none' | 'sm' | 'md' | 'lg' | Content spacing preset. |
side / align | Radix placement props | Position the card around the trigger. |
collisionPadding | number | Viewport collision padding. |
portal | boolean | Render content in a portal for clipping containers. |
showArrow | boolean | Render a tokenized placement arrow. |
maxHeight / scrollable | preset / boolean | Constrain and scroll long previews. |
Anatomy
<HoverCard>
<HoverCardTrigger asChild>
<a href="/profile">@yashi</a>
</HoverCardTrigger>
<HoverCardContent>
<p>Card content</p>
</HoverCardContent>
</HoverCard>Content styling
HoverCardContent renders a tokenized card with configurable surface, padding, max height, optional arrow, and animated entrance/exit. Pass size, side, align, sideOffset, and collisionPadding to control width and placement.
Composition
- Wrap the trigger element in
HoverCardTrigger— it must be a single focusable child. - Content appears on hover and focus. It stays visible while the cursor is over the card.
- Keep content read-only. For interactive content (buttons, links), use Popover.
- Use
timingfor common delay presets. Override withopenDelayandcloseDelaywhen a product workflow needs exact timings. - Use
portalwhen the trigger sits inside a clipped table, scroll area, or card. - Use
maxHeightwithscrollablefor long previews instead of letting the card grow past the viewport.