Join our Discord Community

Hover Card

A contextual popup that appears on hover, perfect for previewing content, user profiles, and additional information without leaving the current page.

You know when you're scrolling Twitter and hover over someone's name to see their bio? That's what hover cards do - show useful info without making you click away and lose your place.

Rich profile preview

Hover to see detailed user information:

Loading component...

Built on Radix UI, so the positioning and accessibility stuff is handled. Works with mouse, keyboard, whatever.

npx shadcn@latest add hover-card

Why hover cards just work

Ever been scared to click a link because you don't know where it goes? Or had to open a new tab just to check someone's profile? Hover cards fix that - you get a quick peek without losing your spot.

Essential hover card patterns you'll use

Simple content preview

Just the basics:

Loading component...

Detailed user profile

Full profile with follower counts and all that:

Loading component...

Product previews

Quick product info before they click:

Loading component...

So you know what you're about to click:

Loading component...

Status and metrics

Server status, performance metrics, that stuff:

Loading component...

API Reference

HoverCard

Root component that manages hover card state and positioning.

PropTypeDefaultDescription
openboolean-Whether the hover card is open
onOpenChange(open: boolean) => void-Callback when open state changes
defaultOpenbooleanfalseDefault open state (uncontrolled)
openDelaynumber700Delay before opening (milliseconds)
closeDelaynumber300Delay before closing (milliseconds)
childrenReact.ReactNode-HoverCardTrigger and HoverCardContent

HoverCardTrigger

Element that triggers the hover card when hovered or focused.

PropTypeDefaultDescription
asChildbooleanfalseRender as child element instead of button
childrenReact.ReactNode-Trigger content

HoverCardContent

The popup content that appears on hover or focus.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
align"start" | "center" | "end""center"Alignment relative to trigger
side"top" | "right" | "bottom" | "left""bottom"Preferred side to open
sideOffsetnumber4Distance from trigger element
alignOffsetnumber0Offset from align position
avoidCollisionsbooleantruePrevent collisions with viewport edges
collisionBoundaryElement | Element[][]Boundary elements for collision detection
sticky"partial" | "always""partial"Sticky positioning behavior
childrenReact.ReactNode-Card content

Timing Configuration

Delay TypeDefaultDescriptionBest Practice
openDelay700msTime before showing card500-1000ms for comfortable UX
closeDelay300msTime before hiding card200-500ms to prevent flicker

Positioning Options

SideDescriptionUse Cases
topOpens above triggerBottom navigation, footers
bottomOpens below triggerDefault, most menu items
leftOpens to the leftRight-aligned content
rightOpens to the rightLeft-aligned content, sidebars

Alignment Options

AlignDescriptionVisual Result
startAligns to start edgeLeft-aligned for horizontal, top for vertical
centerCenters on triggerBalanced positioning
endAligns to end edgeRight-aligned for horizontal, bottom for vertical

Interaction States

StateTriggerDuration
IdleNo interaction-
Pending OpenHover/focus startsopenDelay duration
OpenCard visibleUntil leave/blur + closeDelay
Pending CloseLeave/blur startscloseDelay duration
ClosedCard hidden-

Accessibility Features

FeatureImplementation
Keyboard SupportOpens on focus, closes on blur/escape
ARIA AttributesProper labeling and describedby relationships
Focus ManagementMaintains focus trap when needed
Screen ReadersAnnounces content changes appropriately
High ContrastRespects system color preferences
Reduced MotionHonors user motion preferences

Common patterns that work

User profiles - Perfect for @mentions, author credits, or team member lists. Show avatar, bio, join date, and social stats without leaving the page.

Product previews - Let users peek at items before clicking through. Include images, ratings, prices, and quick action buttons.

Link previews - Give context for external links. Show site info, descriptions, and trust indicators so users know what they're clicking.

Status displays - Surface system health, performance metrics, or feature availability with rich context on hover.

Make hover cards that actually help

The best hover cards feel invisible until you need them. Here's how to nail that:

  • Show stuff people care about - Profile cards with follower counts, not just names
  • Time it right - Too fast feels jumpy, too slow feels broken (700ms is usually perfect)
  • Size for content - Big enough to be useful, small enough to not dominate the screen
  • Make it scannable - Good typography hierarchy so people find what they need fast
  • Add useful actions - Follow buttons, add to cart, copy links - stuff people actually want to do
  • Don't break on mobile - Touch devices are tricky, have a backup plan
  • Keep it snappy - Nobody wants to wait 3 seconds for a profile picture to load
  • Stay predictable - If cards pop up from different directions, it's confusing
  • Easy escape - Click outside, hit escape, whatever - make it obvious how to close them