Skip to content

shadcn.io is not affiliated with official shadcn/ui

Shadcn Hover Card for React

Popover that appears on hover.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/aria/hover-card.json

Anatomy

HoverCardArrow
└── HoverCardArrowTip
HoverCardTrigger
HoverCardContent
└── HoverCardPositioner

Usage

import { Button } from "@/components/ui/button";
import {
  HoverCard,
  HoverCardContent,
  HoverCardTrigger,
} from "@/components/ui/hover-card";
<HoverCard>
  <HoverCardTrigger asChild>
    <Button variant="link">Hover Here</Button>
  </HoverCardTrigger>
  <HoverCardContent className="flex w-64 flex-col gap-0.5">
    <div className="font-semibold">@nextjs</div>
    <div>The React Framework – created and maintained by @vercel.</div>
    <div className="mt-1 text-muted-foreground text-xs">
      Joined December 2021
    </div>
  </HoverCardContent>
</HoverCard>

Accessibility

KeyDescription
Enter
Activate the focused item.
Space
Activate the focused control.

Demos

Sides

Position the hover card with Ark positioning.placement.

Rtl

Right-to-left hover card. See the RTL configuration guide for document direction.

API Reference

HoverCard

PropType
AttributeType
CSS variableType
--trigger-anchor-pointstring

HoverCardTrigger

PropType
AttributeType