# 悬停卡片 · JGuang UI

> 悬停或聚焦时展示关联内容的预览。

- 页面: https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/hover-card
- 改编自: shadcn/ui 文档 (MIT) @ bc0705384b51252af26dcc65425b216bf5eb063c
- 说明：正文保留英文原文。

> 示例 `hover-card-demo`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/hover-card


## Installation


  

**Command**


  

**Manual**


```text
Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.
```


### Install the following dependencies:


```bash
npm install radix-ui
```


### Copy and paste the following code into your project.


[View complete source: components/ui/hover-card.tsx](/r/jguang-ui/radix/hover-card.json)


### Update the import paths to match your project setup.


## Usage

```tsx showLineNumbers
import {
  HoverCard,
  HoverCardContent,
  HoverCardTrigger,
} from "@/components/ui/hover-card"
```

```tsx showLineNumbers
<HoverCard>
  <HoverCardTrigger>Hover</HoverCardTrigger>
  <HoverCardContent>
    The React Framework – created and maintained by @vercel.
  </HoverCardContent>
</HoverCard>
```

## Composition

Use the following composition to build a `HoverCard`:

```text
HoverCard
├── HoverCardTrigger
└── HoverCardContent
```

## Trigger Delays

Use `openDelay` and `closeDelay` on the `HoverCard` to control when the card opens and
closes.

```tsx showLineNumbers
<HoverCard openDelay={100} closeDelay={200}>
  <HoverCardTrigger>Hover</HoverCardTrigger>
  <HoverCardContent>Content</HoverCardContent>
</HoverCard>
```

## Positioning

Use the `side` and `align` props on `HoverCardContent` to control placement.

```tsx showLineNumbers
<HoverCard>
  <HoverCardTrigger>Hover</HoverCardTrigger>
  <HoverCardContent side="top" align="start">
    Content
  </HoverCardContent>
</HoverCard>
```

## Basic


> 示例 `hover-card-demo`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/hover-card


## Sides


> 示例 `hover-card-sides`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/hover-card


## RTL

To enable RTL support in JGuang UI, see the [RTL configuration guide](/systems/jguang-ui/docs/rtl).


> 示例 `hover-card-rtl`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/hover-card


## API Reference

See the [Radix UI](https://www.radix-ui.com/docs/primitives/components/hover-card#api-reference) documentation for more information.

---

JGuang 全部资源索引: https://jiguang132.com/llms.txt
