Components组件Base UIBase UI 组件
悬停卡片
悬停或聚焦时展示关联内容的预览。
中文模式已适配导航、标题、简介、目录与常用章节名称。翻译状态:部分完成;技术正文目前仍为英文。
Loading JGuang UI example…
安装
Command
Manual
Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.
安装以下依赖:
npm install @base-ui/react
将以下代码复制到你的项目中。
View complete source: components/ui/hover-card.tsx
根据项目配置更新导入路径。
用法
import {
HoverCard,
HoverCardContent,
HoverCardTrigger,
} from "@/components/ui/hover-card"
<HoverCard>
<HoverCardTrigger>Hover</HoverCardTrigger>
<HoverCardContent>
The React Framework – created and maintained by @vercel.
</HoverCardContent>
</HoverCard>
Composition
Use the following composition to build a HoverCard:
HoverCard
├── HoverCardTrigger
└── HoverCardContent
Trigger Delays
Use delay and closeDelay on the trigger to control when the card opens and
closes.
<HoverCard>
<HoverCardTrigger delay={100} closeDelay={200}>
Hover
</HoverCardTrigger>
<HoverCardContent>Content</HoverCardContent>
</HoverCard>
Positioning
Use the side and align props on HoverCardContent to control placement.
<HoverCard>
<HoverCardTrigger>Hover</HoverCardTrigger>
<HoverCardContent side="top" align="start">
Content
</HoverCardContent>
</HoverCard>
Basic
Loading JGuang UI example…
Sides
Loading JGuang UI example…
从右到左布局
To enable RTL support in JGuang UI, see the RTL configuration guide.
Loading JGuang UI example…
API 参考
See the Base UI documentation for more information.
来源: components/base/hover-card.mdx
JGuang UI 技术文档。