127k

Hover Card

A popover that appears on hover, focus, or long press to preview content available behind a link.

"use client"

import { Button } from "@/components/ui/button"

Installation

pnpm dlx shadcn@latest add hover-card

Usage

import { HoverCard, HoverCardTrigger } from "@/components/ui/hover-card"
<HoverCardTrigger>
  <Button variant="link">Hover</Button>
  <HoverCard>
    The React Framework – created and maintained by @vercel.
  </HoverCard>
</HoverCardTrigger>

Composition

Use the following composition to build a HoverCard:

HoverCardTrigger
├── Button
└── HoverCard

Trigger Delays

Use delay and closeDelay on the HoverCardTrigger to control when the card opens and closes.

<HoverCardTrigger delay={100} closeDelay={200}>
  <Button variant="link">Hover</Button>
  <HoverCard>Content</HoverCard>
</HoverCardTrigger>

Positioning

Use the placement prop on HoverCard to control placement.

<HoverCardTrigger>
  <Button variant="link">Hover</Button>
  <HoverCard placement="top">Content</HoverCard>
</HoverCardTrigger>

Basic

"use client"

import { Button } from "@/components/ui/button"

Sides

"use client"

import { Button } from "@/components/ui/button"

RTL

To enable RTL support in shadcn/ui, see the RTL configuration guide.

"use client"

import {

API Reference

See the React Aria documentation for more information.

Hover Card

A popover that appears on hover, focus, or long press to preview content available behind a link.

"use client"

import { Button } from "@/components/ui/button"

Installation

pnpm dlx shadcn@latest add hover-card

Usage

import { HoverCard, HoverCardTrigger } from "@/components/ui/hover-card"
<HoverCardTrigger>
  <Button variant="link">Hover</Button>
  <HoverCard>
    The React Framework – created and maintained by @vercel.
  </HoverCard>
</HoverCardTrigger>

Composition

Use the following composition to build a HoverCard:

HoverCardTrigger
├── Button
└── HoverCard

Trigger Delays

Use delay and closeDelay on the HoverCardTrigger to control when the card opens and closes.

<HoverCardTrigger delay={100} closeDelay={200}>
  <Button variant="link">Hover</Button>
  <HoverCard>Content</HoverCard>
</HoverCardTrigger>

Positioning

Use the placement prop on HoverCard to control placement.

<HoverCardTrigger>
  <Button variant="link">Hover</Button>
  <HoverCard placement="top">Content</HoverCard>
</HoverCardTrigger>

Basic

"use client"

import { Button } from "@/components/ui/button"
import { HoverCard, HoverCardTrigger } from "@/components/ui/hover-card"

export function HoverCardDemo() {
  return (
    <HoverCardTrigger delay={10} closeDelay={100}>
      <Button variant="link">Hover Here</Button>
      <HoverCard 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-xs text-muted-foreground">
          Joined December 2021
        </div>
      </HoverCard>
    </HoverCardTrigger>
  )
}

Sides

"use client"

import { Button } from "@/components/ui/button"

RTL

To enable RTL support in shadcn/ui, see the RTL configuration guide.

"use client"

import {

API Reference

See the React Aria documentation for more information.