Components组件Radix UIRadix UI 组件
工具提示
悬停或聚焦时显示简短的说明文字。
中文模式已适配导航、标题、简介、目录与常用章节名称。翻译状态:部分完成;技术正文目前仍为英文。
Loading JGuang UI example…
安装
Command
Manual
Run the following command:
Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.
Add the ,[object Object], to the root of your app.
import { TooltipProvider } from "@/components/ui/tooltip"
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
<TooltipProvider>{children}</TooltipProvider>
</body>
</html>
)
}
安装以下依赖:
npm install radix-ui
将以下代码复制到你的项目中。
View complete source: components/ui/tooltip.tsx
根据项目配置更新导入路径。
Add the ,[object Object], to the root of your app.
import { TooltipProvider } from "@/components/ui/tooltip"
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
<TooltipProvider>{children}</TooltipProvider>
</body>
</html>
)
}
用法
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip"
<Tooltip>
<TooltipTrigger>Hover</TooltipTrigger>
<TooltipContent>
<p>Add to library</p>
</TooltipContent>
</Tooltip>
Composition
Use the following composition to build a Tooltip:
Tooltip
├── TooltipTrigger
└── TooltipContent
Side
Use the side prop to change the position of the tooltip.
Loading JGuang UI example…
With Keyboard Shortcut
Loading JGuang UI example…
Disabled Button
Show a tooltip on a disabled button by wrapping it with a span.
Loading JGuang UI example…
从右到左布局
To enable RTL support in JGuang UI, see the RTL configuration guide.
Loading JGuang UI example…
API 参考
See the Radix Tooltip documentation.
来源: components/radix/tooltip.mdx
JGuang UI 技术文档。