Hover Card
A preview that appears when the pointer rests on a link. It is 320px wide with 16px padding.
Installation
npx shadcn@latest add @sevenone/hover-cardUsage
import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
} from "@/components/ui/hover-card"Examples
Profile preview
<HoverCard>
<HoverCardTrigger asChild>
<Button variant="link">@sevenone</Button>
</HoverCardTrigger>
<HoverCardContent>
<div className="flex gap-4">
<Avatar>
<AvatarFallback>S1</AvatarFallback>
</Avatar>
<div className="grid gap-1">
<h4 className="font-semibold">@sevenone</h4>
<p>The accessible design system, with 7:1 contrast and 44px targets.</p>
<p className="text-xs text-muted-foreground">Joined November 2026</p>
</div>
</div>
</HoverCardContent>
</HoverCard>Accessibility
- It also opens when the link gets keyboard focus, and Esc closes it.
- Touch screens have no hover, so the link must work on its own: the card is only a preview.
- Never put buttons or the only copy of important information inside it.