Hover Card

Snappy preview overlays triggered by hovering a link or name, with rich content and no click interruption at all.

Loading preview

Examples

Practical examples and common states for the same installable component.

Profile

Inline profile mention with a rich bio card and quick follow action.

Requires: avatarbutton

examples/hover-card-profile.tsx
import { HoverCard, HoverCardTrigger, HoverCardContent } from "@/components/wensity/hover-card";
import { Avatar, AvatarImage, AvatarFallback } from "@/components/wensity/avatar";
import { Button } from "@/components/wensity/button";
export function ProfileHoverCard() {
return (
<p className="max-w-sm text-sm leading-6 text-[var(--muted-foreground)]">
Nina tagged{" "}
<HoverCard openDelay={300} closeDelay={150}>
<HoverCardTrigger asChild>
<button type="button" className="bg-transparent p-0 font-medium text-[var(--foreground)] underline decoration-[var(--border)] underline-offset-4">
@ksparth12
</button>
</HoverCardTrigger>
<HoverCardContent width="lg" className="p-4">
<div className="flex items-start justify-between gap-4">
<Avatar size="md">
<AvatarImage src="https://assets.wensity.com/avatars/1.webp" alt="Parth Sharma" />
<AvatarFallback>PS</AvatarFallback>
</Avatar>
<Button size="sm" variant="secondary">Follow</Button>
</div>
<div className="mt-3">
<p className="text-sm font-semibold text-[var(--foreground)]">Parth Sharma</p>
<p className="text-[11px] text-[var(--muted-foreground)]">@ksparth12</p>
<p className="mt-2 text-xs leading-relaxed text-[var(--muted-foreground)]">
Full-Stack Developer, Freelancer, & Founder. Obsessed with crafting web experiences that feel alive.
</p>
</div>
</HoverCardContent>
</HoverCard>{" "}
for the final polish pass.
</p>
);
}

Rich Preview

Detailed dashboard with icons, star counts, and tags.

examples/hover-card-rich.tsx
import { HoverCard, HoverCardTrigger, HoverCardContent } from "@/components/wensity/hover-card";
import { IconBrandGithub, IconStar, IconGitFork } from "@tabler/icons-react";
export function RichHoverCard() {
return (
<HoverCard openDelay={300} closeDelay={150}>
<HoverCardTrigger asChild>
<a href="#" className="text-sm font-medium text-[var(--foreground)] underline underline-offset-4 hover:text-[var(--muted-foreground)]">wensity-mono</a>
</HoverCardTrigger>
<HoverCardContent width="lg" className="p-4">
<div className="flex items-center gap-2">
<IconBrandGithub className="size-4 text-[var(--foreground)]" />
<span className="text-xs font-semibold text-[var(--foreground)]">wensity-mono</span>
</div>
<p className="mt-2 text-xs text-[var(--muted-foreground)]">
Turborepo monorepo for the Wensity Next.js marketplace and component library.
</p>
<div className="mt-4 flex items-center gap-4 text-[10px] text-[var(--muted-foreground)]">
<span className="flex items-center gap-1"><IconStar className="size-3" /> 1,289</span>
<span className="flex items-center gap-1"><IconGitFork className="size-3" /> 142</span>
</div>
</HoverCardContent>
</HoverCard>
);
}

Media

Visual overlay showing images and media elements.

examples/hover-card-media.tsx
import { HoverCard, HoverCardTrigger, HoverCardContent } from "@/components/wensity/hover-card";
export function MediaHoverCard() {
return (
<HoverCard openDelay={300} closeDelay={150}>
<HoverCardTrigger asChild>
<a href="#" className="text-sm font-medium text-[var(--foreground)] underline underline-offset-4 hover:text-[var(--muted-foreground)]">fintech-template</a>
</HoverCardTrigger>
<HoverCardContent width="lg" className="p-0 overflow-hidden">
<img src="https://assets.wensity.com/templates/fintech-template/marketplace/hero.webp" alt="Preview" className="w-full object-cover aspect-[16/10]" />
<div className="p-4">
<p className="text-sm font-semibold text-[var(--foreground)]">Fintech Dashboard</p>
<p className="mt-1 text-xs text-[var(--muted-foreground)]">Clean financial application layout with charts.</p>
</div>
</HoverCardContent>
</HoverCard>
);
}

Interactive

Interactive content elements such as buttons and switches inside the card.

Requires: switchbutton

examples/hover-card-interactive.tsx
import { HoverCard, HoverCardTrigger, HoverCardContent, HoverCardFooter } from "@/components/wensity/hover-card";
import { Switch } from "@/components/wensity/switch";
import { Button } from "@/components/wensity/button";
export function InteractiveHoverCard() {
return (
<HoverCard openDelay={300} closeDelay={150}>
<HoverCardTrigger asChild>
<a href="#" className="text-sm font-medium text-[var(--foreground)] underline underline-offset-4 hover:text-[var(--muted-foreground)]">Notifications</a>
</HoverCardTrigger>
<HoverCardContent width="md" className="p-4">
<div className="flex items-start justify-between gap-4">
<div>
<p className="text-sm font-semibold text-[var(--foreground)]">Push Notifications</p>
<p className="text-xs text-[var(--muted-foreground)]">Receive alerts for registry changes.</p>
</div>
<Switch checked />
</div>
<HoverCardFooter className="mt-3.5 pt-3">
<Button
size="sm"
variant="white"
className="h-7 rounded-md px-2.5 text-[11px] font-medium"
>
Configure
</Button>
</HoverCardFooter>
</HoverCardContent>
</HoverCard>
);
}

Props

PropTypeDefaultDescription
openboolean-Controlled open state.
onOpenChange(open: boolean) => void-Called when the card opens or closes.
openDelaynumber600Milliseconds the pointer must rest before the card opens.
closeDelaynumber300Milliseconds before the card closes after the pointer leaves.