---
title: "Hover Card"
description: "A card that opens when people point at a link or tab to it. It shows a preview, such as a profile or a page, so they need not leave."
url: https://gelatinui.com/components/hover-card
markdown_url: https://gelatinui.com/components/hover-card.md
access: free
install: "npx shadcn@latest add @gelatin-ui/hover-card"
registry_item: https://gelatinui.com/r/hover-card.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Hover Card

> A card that opens when people point at a link or tab to it. It shows a preview, such as a profile or a page, so they need not leave.

Page: https://gelatinui.com/components/hover-card

## When to use it

Best for: A rich preview of a link on hover and focus, such as a person, a page, or a repository.

- Use it for an extra look at a link target that has its own page.
- Keep everything in the card on the target page too: touch has no hover.
- Render your router link through `render` on `HoverCardTrigger`.

## When not to use it

- For a short label of a control, use a [Tooltip](https://gelatinui.com/components/tooltip.md).
- For content the user must click to open and act in, use a [Popover](https://gelatinui.com/components/popover.md).

## Notes for agents

- `HoverCardTrigger` renders an `<a>` with no look; style it as a link.
- `delay` is 600ms and `closeDelay` is 300ms by default.
- `createHoverCardHandle` lets many links share one card, with a `payload` per link.

## Anatomy

```text
HoverCard
├─ HoverCardTrigger (0..n)
├─ HoverCardContent (0..n)
└─ HoverCardViewport (0..n)
```

## API reference

### HoverCard

Also takes every prop of Base UI `PreviewCard.Root`: https://base-ui.com/react/components/preview-card

### HoverCardTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `PreviewCard.Trigger`: https://base-ui.com/react/components/preview-card

### HoverCardContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `arrow` | `boolean` | false | Show an arrow that points at the link. The gap grows from 4px to 8px. |
| `backdrop` | `boolean` | false | Put a clear layer under the card (Base UI `PreviewCard.Backdrop`). Hover on the page stops. |
| `portalProps` | `Omit` |  | Other Base UI props of the inner parts. A `className` here adds to the component classes. |
| `positionerProps` | `PopupPartProps` |  |  |
| `backdropProps` | `PopupPartProps<PreviewCardBackdropProps>` |  |  |
| `arrowProps` | `PopupPartProps<PreviewCardArrowProps>` |  |  |

Also takes every prop of Base UI `PreviewCard.Portal`: https://base-ui.com/react/components/preview-card

### HoverCardViewport

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `PreviewCard.Viewport`: https://base-ui.com/react/components/preview-card

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| HoverCardTrigger | `hover-card-trigger` |  |  |  |
| HoverCardContent | `hover-card-content` |  | `--available-height`, `--available-width` |  |
| HoverCardViewport | `hover-card-viewport` |  |  |  |

## Usage

Put the link in `HoverCardTrigger` and the preview in `HoverCardContent`.

```tsx title="mention-preview.tsx"
import { HoverCard, HoverCardContent, HoverCardTrigger } from "@/components/ui/hover-card";

export function MentionPreview() {
  return (
    <HoverCard>
      <HoverCardTrigger href="/people/mila" className="font-medium underline">
        Mila Novak
      </HoverCardTrigger>
      <HoverCardContent>
        <p className="font-medium">Mila Novak</p>
        <p className="text-muted-foreground text-sm">Design lead at Northwind.</p>
      </HoverCardContent>
    </HoverCard>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/hover-card
```

It adds 14 registry items: 11 files, 1886 lines, and the npm packages `@base-ui/react`, `clsx`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Tooltip](https://gelatinui.com/components/tooltip.md): Pick Tooltip for a short text label of a control, such as the name of an icon button.
- [Popover](https://gelatinui.com/components/popover.md): Pick Popover for content that people open with a click and act in, such as a form or filters.
- [Avatar](https://gelatinui.com/components/avatar.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Focus on the link opens the card after the delay. Focus never moves into the card. |

## Accessibility

It is a Base UI Preview Card. Keyboard focus on the link opens it, as a hover does.

The link names its target on its own, and the card holds no only copy of anything.

## Motion

| Part | Motion |
| --- | --- |
| Open | popup · 150ms · ease-panel (0.2, 0.4, 0.2, 1) · fades in and scales from 95% |
| Close | popup-exit · 120ms · ease-out (0, 0, 0.2, 1) |
