---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Hover card

A small card previewing a person or a record while the pointer rests on its name, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `HoverCard`.

## When to use

- A small card previewing a person or a record while the pointer rests on its name.

## When not to use

- For one line about a button use Tooltip.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Hover card on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-hover-card.json --yes
```

```text
Add the Goop Hover card to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { HoverCard, HoverCardTrigger, HoverCardContent, HoverCardPerson } from '@/components/ui/goop/hover-card';
import { Link } from '@/components/ui/goop/link';
import { Avatar } from '@/components/ui/goop/avatar';

function MemberName() {
  return (
    <HoverCard>
      <HoverCardTrigger asChild>
        <Link variant="plain" href="/members/ngozi-ilori">
          Ngozi Ilori
        </Link>
      </HoverCardTrigger>
      <HoverCardContent>
        <HoverCardPerson
          name="Ngozi Ilori"
          description="Design lead"
          meta="Lagos · 14:20 local"
          avatar={
            <Avatar variant="solid" size="lg" name="Ngozi Ilori">
              NI
            </Avatar>
          }
        />
      </HoverCardContent>
    </HoverCard>
  );
}
```

- Fits: record (its recipe).
- Also known as: PreviewCard, ProfileCard, UserCard, LinkPreview, Hovercard.
- Wrap a person's or a record's link in a HoverCard to preview it on hover or focus, with HoverCardPerson for a person; keep every fact on the linked page too, and no control in the card.
- width, padding, gap, text, motion: add no class for these.

## API reference

### Options

- `Defaults: defaultOpen = false; openDelay = 600; closeDelay = 200`

### Parts

- `HoverCardTrigger` — What the card previews; takes asChild
- `HoverCardContent` — The card; container?: HTMLElement | null — Where the card is portalled; the end of `<body>` when left out
- `HoverCardPerson` — A person in the card; name: ReactNode — The person's name; description?: ReactNode — A line under the name: their role or their email; avatar?: ReactNode — Their picture or initials: the theme's `Avatar`, `size="lg"`; meta?: ReactNode — A line under the description: their team, their local time; children?: ReactNode — Anything else, 8 px under the person's lines

- data-slot values (to select a part by): hover-card-content, hover-card-person, hover-card-person-caption, hover-card-person-content, hover-card-person-description, hover-card-person-media, hover-card-person-title, hover-card-trigger

## Keyboard

- Tab: onto the trigger (the caller's link): the card opens after the delay; off it, the card closes
- Escape: close the card at once; it stays closed while the pointer rests on the trigger
- Enter: follow the link, as the link always does

## Accessibility

- The behaviour layer under the part answers keys, focus and dismissal: never write your own.
- expanded: the attribute data-state=closed
- open: the attribute data-state=closed

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Tooltip](/themes/trail/components/tooltip): A short label shown on hover or focus that names an icon button or explains a control.
- [Link](/themes/trail/components/link): A text link to another page or place, in running text or on its own.
- [Avatar](/themes/trail/components/avatar): A person's or a team's picture or initials, beside their name or on its own.
- [Dropdown menu](/themes/trail/components/dropdown-menu): A menu of actions.
