For sighted users to preview content available behind a link.
A HoverCard shows a preview of richer content (a user card, link preview, etc.) when a sighted user hovers a link or trigger.
Tooltip for short, non-interactive labels on controls.Popover when the content must be reachable by all users and may contain interactive elements.warning
HoverCard as the only accessible path to important content. Because it opens on pointer hover, it is not a reliable path for keyboard or screen reader users. Any information inside a HoverCard must also be available through another fully accessible path (usually the underlying link).1import { Button } from "@ngrok/mantle/button";2import { HoverCard } from "@ngrok/mantle/hover-card";3import { Icon } from "@ngrok/mantle/icon";4import { CalendarIcon } from "@phosphor-icons/react/Calendar";5import { ShrimpIcon } from "@phosphor-icons/react/Shrimp";6 7<HoverCard.Root>8 <HoverCard.Trigger asChild>9 <Button type="button" appearance="link">10 Open Hover Card11 </Button>12 </HoverCard.Trigger>13 <HoverCard.Content className="w-80">14 <div className="flex justify-between space-x-4">15 <div className="flex size-16 shrink-0 items-center justify-center rounded-full bg-pink-300">16 <Icon svg={<ShrimpIcon />} className="size-12" />17 </div>18 <div className="space-y-1">19 <h4 className="text-sm font-medium">@ngrok/mantle</h4>20 <p className="text-sm">The Design System – created and maintained by @ngrok.</p>21 <div className="flex items-center pt-2">22 <Icon svg={<CalendarIcon />} className="mr-2 h-4 w-4 opacity-70" />{" "}23 <span className="text-muted-foreground text-xs">Joined November 2023</span>24 </div>25 </div>26 </div>27 </HoverCard.Content>28</HoverCard.Root>;Compose the parts of a HoverCard together to build your own:
HoverCard.Root├── HoverCard.Trigger└── HoverCard.ContentThe HoverCard component is built on top of Radix UI Hover Card.
The root stateful component that manages the open/closed state of the hover card.
The trigger element that opens the hover card when hovered.
The content to render inside the hover card. Appears in a portal with rich styling and animations.