Debian Codegraph @

node/@patternfly/patternfly/docs/components/Tooltip/examples/Tooltip.md

raw
1 ---
2 id: Tooltip
3 section: components
4 cssPrefix: pf-v6-c-tooltip
5 ---import "./Tooltip.css"
6
7 ## Examples
8
9 ### Top
10
11 ```html
12 <div class="pf-v6-c-tooltip pf-m-top" role="tooltip">
13 <div class="pf-v6-c-tooltip__arrow"></div>
14
15 <div
16 class="pf-v6-c-tooltip__content"
17 id="tooltip-top-content"
18 >Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
19 </div>
20
21 ```
22
23 ### Right
24
25 ```html
26 <div class="pf-v6-c-tooltip pf-m-right" role="tooltip">
27 <div class="pf-v6-c-tooltip__arrow"></div>
28
29 <div
30 class="pf-v6-c-tooltip__content"
31 id="tooltip-right-content"
32 >Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
33 </div>
34
35 ```
36
37 ### Bottom
38
39 ```html
40 <div class="pf-v6-c-tooltip pf-m-bottom" role="tooltip">
41 <div class="pf-v6-c-tooltip__arrow"></div>
42
43 <div
44 class="pf-v6-c-tooltip__content"
45 id="tooltip-bottom-content"
46 >Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
47 </div>
48
49 ```
50
51 ### Left
52
53 ```html
54 <div class="pf-v6-c-tooltip pf-m-left" role="tooltip">
55 <div class="pf-v6-c-tooltip__arrow"></div>
56
57 <div
58 class="pf-v6-c-tooltip__content"
59 id="tooltip-left-content"
60 >Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
61 </div>
62
63 ```
64
65 ### Left with top and bottom positions
66
67 ```html
68 <div class="pf-v6-c-tooltip pf-m-left-top" role="tooltip">
69 <div class="pf-v6-c-tooltip__arrow"></div>
70
71 <div
72 class="pf-v6-c-tooltip__content"
73 id="tooltip-left-top-content"
74 >Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
75 </div>
76 <br />
77 <div class="pf-v6-c-tooltip pf-m-left-bottom" role="tooltip">
78 <div class="pf-v6-c-tooltip__arrow"></div>
79
80 <div
81 class="pf-v6-c-tooltip__content"
82 id="tooltip-left-bottom-content"
83 >Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
84 </div>
85
86 ```
87
88 ### Bottom with left and right positions
89
90 ```html
91 <div class="pf-v6-c-tooltip pf-m-bottom-left" role="tooltip">
92 <div class="pf-v6-c-tooltip__arrow"></div>
93
94 <div
95 class="pf-v6-c-tooltip__content"
96 id="tooltip-bottom-left-content"
97 >Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
98 </div>
99 <br />
100 <div class="pf-v6-c-tooltip pf-m-bottom-right" role="tooltip">
101 <div class="pf-v6-c-tooltip__arrow"></div>
102
103 <div
104 class="pf-v6-c-tooltip__content"
105 id="tooltip-bottom-right-content"
106 >Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
107 </div>
108
109 ```
110
111 ### Left aligned text
112
113 ```html
114 <div class="pf-v6-c-tooltip pf-m-top" role="tooltip">
115 <div class="pf-v6-c-tooltip__arrow"></div>
116
117 <div
118 class="pf-v6-c-tooltip__content pf-m-text-align-left"
119 id="tooltip-text-align-left-example"
120 >Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
121 </div>
122
123 ```
124
125 ## Documentation
126
127 ### Overview
128
129 A tooltip is used to provide contextual information for another component on hover. The tooltip itself is made up of two elements: arrow and content. One of the directional modifiers (`.pf-m-left`, `.pf-m-top`, etc.) is required on the tooltip component.
130
131 ### Usage
132
133 | Class | Applied to | Outcome |
134 | -- | -- | -- |
135 | `.pf-v6-c-tooltip` | `<div>` | Creates a tooltip. Always use with a modifier class that positions the tooltip relative to the element it describes. **Required**|
136 | `.pf-v6-c-tooltip__arrow` | `<div>` | Creates an arrow pointing towards the element the tooltip describes. **Required** |
137 | `.pf-v6-c-tooltip__content` | `<div>` | Creates the body of the tooltip. **Required** |
138 | `.pf-m-left{-top/bottom}` | `.pf-v6-c-tooltip` | Positions the tooltip to the left (or left top/left bottom) of the element. |
139 | `.pf-m-right{-top/bottom}` | `.pf-v6-c-tooltip` | Positions the tooltip to the right (or right top/right bottom) of the element. |
140 | `.pf-m-top{-left/right}` | `.pf-v6-c-tooltip` | Positions the tooltip to the top (or top left/top right) of the element. |
141 | `.pf-m-bottom{-left/right}` | `.pf-v6-c-tooltip` | Positions the tooltip to the bottom (or bottom left/bottom right) of the element. |
142 | `.pf-m-text-align-left` | `.pf-v6-c-tooltip__content` | Modifies tooltip content to text align left. |