Component guideEditable source

Hover Card

Supplementary preview content associated with a link.

Original component docs
On this page4 sectionsBack to top

Use Hover Card to preview the destination or entity behind a link. Keep the link useful without the card. Use Popover for an explicit interactive popup and Tooltip for a very short hint.

Live preview
Loading preview...

#Installation

Complete the base setup. For manual installation:

npx shadcn@latest add https://neobrutal-ui.andongmin.com/r/hover-card.json

#Usage

import { HoverCard, HoverCardContent, HoverCardTrigger } from "@/components/ui/hover-card";

export default function DocumentationPreview() {
  return (
    <HoverCard>
      <HoverCardTrigger href="/docs" className="underline">
        Read the documentation
      </HoverCardTrigger>
      <HoverCardContent>
        <p>Installation steps, component examples, and theme guidance.</p>
      </HoverCardContent>
    </HoverCard>
  );
}

#API reference

Prop / partPurposeDefault
HoverCard.open / onOpenChangeControlled preview visibilityUncontrolled
HoverCardTrigger.href / renderLink destination or compositionAnchor
HoverCardContent.side / alignPreferred placementbottom / center
HoverCardContent.sideOffsetTrigger-to-card gap4
HoverCardContent.classNameWidth and layoutStyled surface
HoverCardTrigger.delay / closeDelayHover opening and closing delay, in milliseconds700 / 300
HoverCardContent.alignOffset / arrowPadding / collisionPaddingAlignment, arrow, and collision-boundary spacing, in pixels0
HoverCardContent.positionMethodCSS positioning methodfixed

#Accessibility

Do not place required instructions or the only copy of an action inside hover-only content. Touch and keyboard interactions differ from hover, so provide an explicit alternative when opening the content matters. Use descriptive link text and avoid duplicate essential announcements for decorative preview text.