|
1
|
import { ComponentExample } from "@/components/ComponentExample" |
|
2
|
import { ComponentReference } from "@/components/ComponentReference" |
|
3
|
|
|
4
|
export const metadata = { |
|
5
|
title: `Tooltip`, |
|
6
|
} |
|
7
|
|
|
8
|
# {metadata.title} |
|
9
|
|
|
10
|
|
|
11
|
A component that displays a pop-up with additional information when hovering over or focusing on an element. |
|
12
|
|
|
13
|
In this guide, you'll learn how to use the Tooltip component. |
|
14
|
|
|
15
|
<ComponentExample name="tooltip-demo" /> |
|
16
|
|
|
17
|
## Usage |
|
18
|
|
|
19
|
```tsx |
|
20
|
import { Tooltip } from "@medusajs/ui" |
|
21
|
``` |
|
22
|
|
|
23
|
```tsx |
|
24
|
<Tooltip content="Tooltip content">Trigger</Tooltip> |
|
25
|
``` |
|
26
|
|
|
27
|
--- |
|
28
|
|
|
29
|
## API Reference |
|
30
|
|
|
31
|
<ComponentReference mainComponent="Tooltip" /> |
|
32
|
|
|
33
|
--- |
|
34
|
|
|
35
|
## Usage Outside Medusa Admin with TooltipProvider |
|
36
|
|
|
37
|
If you're using the `Tooltip` component in a project other than the Medusa Admin, make sure to include the `TooltipProvider` somewhere up in your component tree: |
|
38
|
|
|
39
|
```tsx |
|
40
|
<TooltipProvider> |
|
41
|
<Tooltip content="Tooltip content">Trigger</Tooltip> |
|
42
|
</TooltipProvider> |
|
43
|
``` |
|
44
|
|
|
45
|
### TooltipProvider Reference |
|
46
|
|
|
47
|
<ComponentReference mainComponent="TooltipProvider" /> |
|
48
|
|
|
49
|
--- |
|
50
|
|
|
51
|
## Examples |
|
52
|
|
|
53
|
### Changing Tooltip Side |
|
54
|
|
|
55
|
<ComponentExample name="tooltip-sides" /> |
|
56
|
|
|
57
|
### Set Tooltip Max Width |
|
58
|
|
|
59
|
<ComponentExample name="tooltip-maxwidth" /> |