Components
Hover Card
A card that appears on hover over a trigger, showing supplementary information without a click or navigation away from the current surface.
Preview
Rendered with live Cognition tokens. Hover the handle to open the real card, no dark: classes.
Variants
Derek Ho
Co-founder at Distyl. Building the team behind the Cognition design system.
Default
Derek Ho
Co-founder at Distyl. Building the team behind the Cognition design system.
With avatar
Derek Ho
Co-founder at Distyl. Building the team behind the Cognition design system.
With metadata
A plain text preview, the same with an avatar, or enriched with a row of metadata. The panels above are shown open for reference.
States
Closed. Only the trigger shows.
Derek Ho
Co-founder at Distyl. Building the team behind the Cognition design system.
Open. Appears after the hover delay.
Derek Ho
Co-founder at Distyl. Building the team behind the Cognition design system.
Open with delay. Tune via openDelay.
Hover cannot be shown at rest, so the open states render the card statically. The preview opens the real card on hover.
API
openDelay and closeDelay are set on HoverCard; side and align on HoverCardContent.
Don't and Do
Don't put actions inside a Hover Card. It is read-only supplementary content, and it dismisses as soon as the pointer leaves, so buttons and inputs are hard to reach. When the reader needs to interact with the content, use a Popover instead.
<HoverCard>
<HoverCardTrigger asChild>
<a href="/team/derek-ho">@derekho</a>
</HoverCardTrigger>
<HoverCardContent>Profile preview...</HoverCardContent>
</HoverCard>Use it to preview profile information, link previews, or contextual metadata on hover without leaving the current surface.
import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
} from "@/components/ui/hover-card";
export function HandlePreview() {
return (
<HoverCard>
<HoverCardTrigger asChild>
<button className="text-text-primary hover:underline">
@derekho
</button>
</HoverCardTrigger>
<HoverCardContent className="w-72">
<p className="text-sm font-semibold">Derek Ho</p>
<p className="text-sm text-text-subtle">
Co-founder at Distyl.
</p>
</HoverCardContent>
</HoverCard>
);
}