Files
shadcn-ui/apps/www/content/docs/components/tooltip.mdx
2023-06-23 00:07:19 +04:00

45 lines
790 B
Plaintext

---
title: Tooltip
description: A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
component: true
radix:
link: https://www.radix-ui.com/docs/primitives/components/tooltip
api: https://www.radix-ui.com/docs/primitives/components/tooltip#api-reference
---
<ComponentPreview name="tooltip-demo" />
## Installation
<Steps>
### Command
```bash
npx shadcn-ui@latest add tooltip
```
### Usage
```tsx
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip"
```
```tsx
<TooltipProvider>
<Tooltip>
<TooltipTrigger>Hover</TooltipTrigger>
<TooltipContent>
<p>Add to library</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
```
</Steps>