Debian Codegraph @

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

raw
1 ---
2 id: Popover
3 section: components
4 cssPrefix: pf-v6-c-popover
5 ---import './Popover.css'
6
7 ## Examples
8
9 ### Top
10
11 ```html isFullscreen
12 <div
13 class="pf-v6-c-popover pf-m-top"
14 role="dialog"
15 aria-modal="true"
16 aria-labelledby="popover-top-header"
17 aria-describedby="popover-top-body"
18 >
19 <div class="pf-v6-c-popover__arrow"></div>
20 <div class="pf-v6-c-popover__content">
21 <div class="pf-v6-c-popover__close">
22 <button
23 class="pf-v6-c-button pf-m-plain"
24 type="button"
25 aria-label="Close"
26 >
27 <span class="pf-v6-c-button__icon">
28 <svg
29 class="pf-v6-svg"
30 fill="currentColor"
31 viewBox="0 0 20 20"
32 aria-hidden="true"
33 role="img"
34 width="1em"
35 height="1em"
36 >
37 <path
38 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
39 />
40 </svg>
41 </span>
42 </button>
43 </div>
44 <header class="pf-v6-c-popover__header">
45 <div class="pf-v6-c-popover__title" id="popover-top-header">
46 <h1 class="pf-v6-c-popover__title-text">Popover header</h1>
47 </div>
48 </header>
49 <div
50 class="pf-v6-c-popover__body"
51 id="popover-top-body"
52 >Popovers are triggered by click rather than hover. Click again to close.</div>
53 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
54 </div>
55 </div>
56
57 ```
58
59 ### Right
60
61 ```html isFullscreen
62 <div
63 class="pf-v6-c-popover pf-m-right"
64 role="dialog"
65 aria-modal="true"
66 aria-labelledby="popover-right-header"
67 aria-describedby="popover-right-body"
68 >
69 <div class="pf-v6-c-popover__arrow"></div>
70 <div class="pf-v6-c-popover__content">
71 <div class="pf-v6-c-popover__close">
72 <button
73 class="pf-v6-c-button pf-m-plain"
74 type="button"
75 aria-label="Close"
76 >
77 <span class="pf-v6-c-button__icon">
78 <svg
79 class="pf-v6-svg"
80 fill="currentColor"
81 viewBox="0 0 20 20"
82 aria-hidden="true"
83 role="img"
84 width="1em"
85 height="1em"
86 >
87 <path
88 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
89 />
90 </svg>
91 </span>
92 </button>
93 </div>
94 <header class="pf-v6-c-popover__header">
95 <div class="pf-v6-c-popover__title" id="popover-right-header">
96 <h1 class="pf-v6-c-popover__title-text">Popover header</h1>
97 </div>
98 </header>
99 <div
100 class="pf-v6-c-popover__body"
101 id="popover-right-body"
102 >Popovers are triggered by click rather than hover. Click again to close.</div>
103 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
104 </div>
105 </div>
106
107 ```
108
109 ### Bottom
110
111 ```html isFullscreen
112 <div
113 class="pf-v6-c-popover pf-m-bottom"
114 role="dialog"
115 aria-modal="true"
116 aria-labelledby="popover-bottom-header"
117 aria-describedby="popover-bottom-body"
118 >
119 <div class="pf-v6-c-popover__arrow"></div>
120 <div class="pf-v6-c-popover__content">
121 <div class="pf-v6-c-popover__close">
122 <button
123 class="pf-v6-c-button pf-m-plain"
124 type="button"
125 aria-label="Close"
126 >
127 <span class="pf-v6-c-button__icon">
128 <svg
129 class="pf-v6-svg"
130 fill="currentColor"
131 viewBox="0 0 20 20"
132 aria-hidden="true"
133 role="img"
134 width="1em"
135 height="1em"
136 >
137 <path
138 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
139 />
140 </svg>
141 </span>
142 </button>
143 </div>
144 <header class="pf-v6-c-popover__header">
145 <div class="pf-v6-c-popover__title" id="popover-bottom-header">
146 <h1 class="pf-v6-c-popover__title-text">Popover header</h1>
147 </div>
148 </header>
149 <div
150 class="pf-v6-c-popover__body"
151 id="popover-bottom-body"
152 >Popovers are triggered by click rather than hover. Click again to close.</div>
153 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
154 </div>
155 </div>
156
157 ```
158
159 ### Left
160
161 ```html isFullscreen
162 <div
163 class="pf-v6-c-popover pf-m-left"
164 role="dialog"
165 aria-modal="true"
166 aria-labelledby="popover-left-header"
167 aria-describedby="popover-left-body"
168 >
169 <div class="pf-v6-c-popover__arrow"></div>
170 <div class="pf-v6-c-popover__content">
171 <div class="pf-v6-c-popover__close">
172 <button
173 class="pf-v6-c-button pf-m-plain"
174 type="button"
175 aria-label="Close"
176 >
177 <span class="pf-v6-c-button__icon">
178 <svg
179 class="pf-v6-svg"
180 fill="currentColor"
181 viewBox="0 0 20 20"
182 aria-hidden="true"
183 role="img"
184 width="1em"
185 height="1em"
186 >
187 <path
188 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
189 />
190 </svg>
191 </span>
192 </button>
193 </div>
194 <header class="pf-v6-c-popover__header">
195 <div class="pf-v6-c-popover__title" id="popover-left-header">
196 <h1 class="pf-v6-c-popover__title-text">Popover header</h1>
197 </div>
198 </header>
199 <div
200 class="pf-v6-c-popover__body"
201 id="popover-left-body"
202 >Popovers are triggered by click rather than hover. Click again to close.</div>
203 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
204 </div>
205 </div>
206
207 ```
208
209 ### Left top
210
211 ```html isFullscreen
212 <div
213 class="pf-v6-c-popover pf-m-left-top"
214 role="dialog"
215 aria-modal="true"
216 aria-labelledby="popover-left-start-header"
217 aria-describedby="popover-left-start-body"
218 >
219 <div class="pf-v6-c-popover__arrow"></div>
220 <div class="pf-v6-c-popover__content">
221 <div class="pf-v6-c-popover__close">
222 <button
223 class="pf-v6-c-button pf-m-plain"
224 type="button"
225 aria-label="Close"
226 >
227 <span class="pf-v6-c-button__icon">
228 <svg
229 class="pf-v6-svg"
230 fill="currentColor"
231 viewBox="0 0 20 20"
232 aria-hidden="true"
233 role="img"
234 width="1em"
235 height="1em"
236 >
237 <path
238 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
239 />
240 </svg>
241 </span>
242 </button>
243 </div>
244 <header class="pf-v6-c-popover__header">
245 <div class="pf-v6-c-popover__title" id="popover-left-start-header">
246 <h1 class="pf-v6-c-popover__title-text">Popover header</h1>
247 </div>
248 </header>
249 <div
250 class="pf-v6-c-popover__body"
251 id="popover-left-start-body"
252 >This popover is to the left and at the start position</div>
253 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
254 </div>
255 </div>
256
257 ```
258
259 ### Left bottom
260
261 ```html isFullscreen
262 <div
263 class="pf-v6-c-popover pf-m-left-bottom"
264 role="dialog"
265 aria-modal="true"
266 aria-labelledby="popover-left-end-header"
267 aria-describedby="popover-left-end-body"
268 >
269 <div class="pf-v6-c-popover__arrow"></div>
270 <div class="pf-v6-c-popover__content">
271 <div class="pf-v6-c-popover__close">
272 <button
273 class="pf-v6-c-button pf-m-plain"
274 type="button"
275 aria-label="Close"
276 >
277 <span class="pf-v6-c-button__icon">
278 <svg
279 class="pf-v6-svg"
280 fill="currentColor"
281 viewBox="0 0 20 20"
282 aria-hidden="true"
283 role="img"
284 width="1em"
285 height="1em"
286 >
287 <path
288 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
289 />
290 </svg>
291 </span>
292 </button>
293 </div>
294 <header class="pf-v6-c-popover__header">
295 <div class="pf-v6-c-popover__title" id="popover-left-end-header">
296 <h1 class="pf-v6-c-popover__title-text">Popover header</h1>
297 </div>
298 </header>
299 <div
300 class="pf-v6-c-popover__body"
301 id="popover-left-end-body"
302 >This popover is to the left and at the end position</div>
303 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
304 </div>
305 </div>
306
307 ```
308
309 ### Bottom left
310
311 ```html isFullscreen
312 <div
313 class="pf-v6-c-popover pf-m-bottom-left"
314 role="dialog"
315 aria-modal="true"
316 aria-labelledby="popover-bottom-start-header"
317 aria-describedby="popover-bottom-start-body"
318 >
319 <div class="pf-v6-c-popover__arrow"></div>
320 <div class="pf-v6-c-popover__content">
321 <div class="pf-v6-c-popover__close">
322 <button
323 class="pf-v6-c-button pf-m-plain"
324 type="button"
325 aria-label="Close"
326 >
327 <span class="pf-v6-c-button__icon">
328 <svg
329 class="pf-v6-svg"
330 fill="currentColor"
331 viewBox="0 0 20 20"
332 aria-hidden="true"
333 role="img"
334 width="1em"
335 height="1em"
336 >
337 <path
338 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
339 />
340 </svg>
341 </span>
342 </button>
343 </div>
344 <header class="pf-v6-c-popover__header">
345 <div class="pf-v6-c-popover__title" id="popover-bottom-start-header">
346 <h1 class="pf-v6-c-popover__title-text">Popover header</h1>
347 </div>
348 </header>
349 <div
350 class="pf-v6-c-popover__body"
351 id="popover-bottom-start-body"
352 >This popover is to the bottom and at the start position</div>
353 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
354 </div>
355 </div>
356
357 ```
358
359 ### Bottom right
360
361 ```html isFullscreen
362 <div
363 class="pf-v6-c-popover pf-m-bottom-right"
364 role="dialog"
365 aria-modal="true"
366 aria-labelledby="popover-bottom-end-header"
367 aria-describedby="popover-bottom-end-body"
368 >
369 <div class="pf-v6-c-popover__arrow"></div>
370 <div class="pf-v6-c-popover__content">
371 <div class="pf-v6-c-popover__close">
372 <button
373 class="pf-v6-c-button pf-m-plain"
374 type="button"
375 aria-label="Close"
376 >
377 <span class="pf-v6-c-button__icon">
378 <svg
379 class="pf-v6-svg"
380 fill="currentColor"
381 viewBox="0 0 20 20"
382 aria-hidden="true"
383 role="img"
384 width="1em"
385 height="1em"
386 >
387 <path
388 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
389 />
390 </svg>
391 </span>
392 </button>
393 </div>
394 <header class="pf-v6-c-popover__header">
395 <div class="pf-v6-c-popover__title" id="popover-bottom-end-header">
396 <h1 class="pf-v6-c-popover__title-text">Popover header</h1>
397 </div>
398 </header>
399 <div
400 class="pf-v6-c-popover__body"
401 id="popover-bottom-end-body"
402 >This popover is to the bottom and at the end position</div>
403 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
404 </div>
405 </div>
406
407 ```
408
409 ### Without header/footer
410
411 ```html isFullscreen
412 <div
413 class="pf-v6-c-popover pf-m-right"
414 role="dialog"
415 aria-modal="true"
416 aria-label="Popover with no header example"
417 aria-describedby="popover-no-header-body"
418 >
419 <div class="pf-v6-c-popover__arrow"></div>
420 <div class="pf-v6-c-popover__content">
421 <div class="pf-v6-c-popover__close">
422 <button
423 class="pf-v6-c-button pf-m-plain"
424 type="button"
425 aria-label="Close"
426 >
427 <span class="pf-v6-c-button__icon">
428 <svg
429 class="pf-v6-svg"
430 fill="currentColor"
431 viewBox="0 0 20 20"
432 aria-hidden="true"
433 role="img"
434 width="1em"
435 height="1em"
436 >
437 <path
438 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
439 />
440 </svg>
441 </span>
442 </button>
443 </div>
444 <div
445 class="pf-v6-c-popover__body"
446 id="popover-no-header-body"
447 >Popovers are triggered by click rather than hover. Click again to close.</div>
448 </div>
449 </div>
450
451 ```
452
453 ### No padding
454
455 ```html isFullscreen
456 <div
457 class="pf-v6-c-popover pf-m-right pf-m-no-padding"
458 role="dialog"
459 aria-modal="true"
460 aria-label="Popover with no padding example"
461 aria-describedby="popover-no-padding-body"
462 >
463 <div class="pf-v6-c-popover__arrow"></div>
464 <div class="pf-v6-c-popover__content">
465 <div
466 class="pf-v6-c-popover__body"
467 id="popover-no-padding-body"
468 >This popover has no padding itself. Instead it is intended for use with content that has its own padding that prevents it from touching the popover container's edges.</div>
469 </div>
470 </div>
471
472 ```
473
474 ### Width auto
475
476 ```html isFullscreen
477 <div
478 class="pf-v6-c-popover pf-m-right pf-m-width-auto"
479 role="dialog"
480 aria-modal="true"
481 aria-labelledby="popover-width-auto-header"
482 aria-describedby="popover-width-auto-body"
483 >
484 <div class="pf-v6-c-popover__arrow"></div>
485 <div class="pf-v6-c-popover__content">
486 <div class="pf-v6-c-popover__close">
487 <button
488 class="pf-v6-c-button pf-m-plain"
489 type="button"
490 aria-label="Close"
491 >
492 <span class="pf-v6-c-button__icon">
493 <svg
494 class="pf-v6-svg"
495 fill="currentColor"
496 viewBox="0 0 20 20"
497 aria-hidden="true"
498 role="img"
499 width="1em"
500 height="1em"
501 >
502 <path
503 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
504 />
505 </svg>
506 </span>
507 </button>
508 </div>
509 <header class="pf-v6-c-popover__header">
510 <div class="pf-v6-c-popover__title" id="popover-width-auto-header">
511 <h1 class="pf-v6-c-popover__title-text">Popover header</h1>
512 </div>
513 </header>
514 <div
515 class="pf-v6-c-popover__body"
516 id="popover-width-auto-body"
517 >Popovers body</div>
518 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
519 </div>
520 </div>
521
522 ```
523
524 ### Popover with icon in the title
525
526 ```html isFullscreen
527 <div
528 class="pf-v6-c-popover pf-m-left"
529 role="dialog"
530 aria-modal="true"
531 aria-labelledby="popover-icon-title-header"
532 aria-describedby="popover-icon-title-body"
533 >
534 <div class="pf-v6-c-popover__arrow"></div>
535 <div class="pf-v6-c-popover__content">
536 <div class="pf-v6-c-popover__close">
537 <button
538 class="pf-v6-c-button pf-m-plain"
539 type="button"
540 aria-label="Close"
541 >
542 <span class="pf-v6-c-button__icon">
543 <svg
544 class="pf-v6-svg"
545 fill="currentColor"
546 viewBox="0 0 20 20"
547 aria-hidden="true"
548 role="img"
549 width="1em"
550 height="1em"
551 >
552 <path
553 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
554 />
555 </svg>
556 </span>
557 </button>
558 </div>
559 <header class="pf-v6-c-popover__header">
560 <div class="pf-v6-c-popover__title" id="popover-icon-title-header">
561 <span class="pf-v6-c-popover__title-icon">
562 <svg
563 class="pf-v6-svg"
564 fill="currentColor"
565 viewBox="0 0 576 512"
566 aria-hidden="true"
567 role="img"
568 width="1em"
569 height="1em"
570 >
571 <path
572 d="M576 240c0-23.63-12.95-44.04-32-55.12V32.01C544 23.26 537.02 0 512 0c-7.12 0-14.19 2.38-19.98 7.02l-85.03 68.03C364.28 109.19 310.66 128 256 128H64c-35.35 0-64 28.65-64 64v96c0 35.35 28.65 64 64 64h33.7c-1.39 10.48-2.18 21.14-2.18 32 0 39.77 9.26 77.35 25.56 110.94 5.19 10.69 16.52 17.06 28.4 17.06h74.28c26.05 0 41.69-29.84 25.9-50.56-16.4-21.52-26.15-48.36-26.15-77.44 0-11.11 1.62-21.79 4.41-32H256c54.66 0 108.28 18.81 150.98 52.95l85.03 68.03a32.023 32.023 0 0 0 19.98 7.02c24.92 0 32-22.78 32-32V295.13C563.05 284.04 576 263.63 576 240zm-96 141.42l-33.05-26.44C392.95 311.78 325.12 288 256 288v-96c69.12 0 136.95-23.78 190.95-66.98L480 98.58v282.84z"
573 />
574 </svg>
575 </span>
576 <h1 class="pf-v6-c-popover__title-text">Popover with icon title</h1>
577 </div>
578 </header>
579 <div
580 class="pf-v6-c-popover__body"
581 id="popover-icon-title-body"
582 >Popovers are triggered by click rather than hover. Click again to close.</div>
583 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
584 </div>
585 </div>
586
587 ```
588
589 ### Custom alert popover
590
591 ```html isFullscreen
592 <div
593 class="pf-v6-c-popover pf-m-custom pf-m-left"
594 role="dialog"
595 aria-modal="true"
596 aria-labelledby="popover-custom-alert-header"
597 aria-describedby="popover-custom-alert-body"
598 >
599 <div class="pf-v6-c-popover__arrow"></div>
600 <div class="pf-v6-c-popover__content">
601 <div class="pf-v6-c-popover__close">
602 <button
603 class="pf-v6-c-button pf-m-plain"
604 type="button"
605 aria-label="Close"
606 >
607 <span class="pf-v6-c-button__icon">
608 <svg
609 class="pf-v6-svg"
610 fill="currentColor"
611 viewBox="0 0 20 20"
612 aria-hidden="true"
613 role="img"
614 width="1em"
615 height="1em"
616 >
617 <path
618 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
619 />
620 </svg>
621 </span>
622 </button>
623 </div>
624 <header class="pf-v6-c-popover__header">
625 <div class="pf-v6-c-popover__title" id="popover-custom-alert-header">
626 <span class="pf-v6-c-popover__title-icon">
627 <svg
628 class="pf-v6-svg"
629 fill="currentColor"
630 viewBox="0 0 32 32"
631 aria-hidden="true"
632 role="img"
633 width="1em"
634 height="1em"
635 >
636 <path
637 d="M28.75 22v3.5c0 .689-.561 1.25-1.25 1.25h-7.521c.005.084.021.166.021.25 0 2.206-1.794 4-4 4s-4-1.794-4-4c0-.084.016-.166.021-.25H4.5c-.689 0-1.25-.561-1.25-1.25V22a.75.75 0 0 1 .75-.75c1.24 0 2.25-1.009 2.25-2.25v-4c0-4.826 3.528-8.833 8.138-9.605A2.482 2.482 0 0 1 13.5 3.5C13.5 2.122 14.621 1 16 1s2.5 1.122 2.5 2.5c0 .761-.349 1.436-.888 1.895 4.61.772 8.138 4.779 8.138 9.605v4c0 1.241 1.01 2.25 2.25 2.25a.75.75 0 0 1 .75.75Z"
638 />
639 </svg>
640 </span>
641 <h1 class="pf-v6-c-popover__title-text">
642 <span class="pf-v6-screen-reader">
643 Custom
644 alert:
645 </span>
646 Custom popover title
647 </h1>
648 </div>
649 </header>
650 <div
651 class="pf-v6-c-popover__body"
652 id="popover-custom-alert-body"
653 >Popovers are triggered by click rather than hover. Click again to close.</div>
654 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
655 </div>
656 </div>
657
658 ```
659
660 ### Info alert popover
661
662 ```html isFullscreen
663 <div
664 class="pf-v6-c-popover pf-m-info pf-m-top"
665 role="dialog"
666 aria-modal="true"
667 aria-labelledby="popover-info-alert-header"
668 aria-describedby="popover-info-alert-body"
669 >
670 <div class="pf-v6-c-popover__arrow"></div>
671 <div class="pf-v6-c-popover__content">
672 <div class="pf-v6-c-popover__close">
673 <button
674 class="pf-v6-c-button pf-m-plain"
675 type="button"
676 aria-label="Close"
677 >
678 <span class="pf-v6-c-button__icon">
679 <svg
680 class="pf-v6-svg"
681 fill="currentColor"
682 viewBox="0 0 20 20"
683 aria-hidden="true"
684 role="img"
685 width="1em"
686 height="1em"
687 >
688 <path
689 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
690 />
691 </svg>
692 </span>
693 </button>
694 </div>
695 <header class="pf-v6-c-popover__header">
696 <div class="pf-v6-c-popover__title" id="popover-info-alert-header">
697 <span class="pf-v6-c-popover__title-icon">
698 <svg
699 class="pf-v6-svg"
700 fill="currentColor"
701 viewBox="0 0 32 32"
702 aria-hidden="true"
703 role="img"
704 width="1em"
705 height="1em"
706 >
707 <path
708 d="M16 1C7.729 1 1 7.729 1 16s6.729 15 15 15 15-6.729 15-15S24.271 1 16 1Zm1.5 22a1.5 1.5 0 1 1-3 0v-5.157l-.188.04a1.5 1.5 0 0 1-.625-2.934l1.956-.416c.112-.024.223-.032.333-.03l.024-.002a1.5 1.5 0 0 1 1.5 1.5v7Zm-.08-12.58c-.38.37-.89.58-1.42.58a1.998 1.998 0 0 1-1.851-2.76c.051-.13.11-.24.19-.35.07-.11.15-.21.25-.3.74-.75 2.08-.75 2.83 0 .09.09.17.19.24.3.08.11.14.22.189.35.05.12.09.24.11.37.03.13.04.26.04.39 0 .53-.21 1.04-.58 1.42Z"
709 />
710 </svg>
711 </span>
712 <h1 class="pf-v6-c-popover__title-text">
713 <span class="pf-v6-screen-reader">
714 Info
715 alert:
716 </span>
717 Info popover title
718 </h1>
719 </div>
720 </header>
721 <div
722 class="pf-v6-c-popover__body"
723 id="popover-info-alert-body"
724 >Popovers are triggered by click rather than hover. Click again to close.</div>
725 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
726 </div>
727 </div>
728
729 ```
730
731 ### Success alert popover
732
733 ```html isFullscreen
734 <div
735 class="pf-v6-c-popover pf-m-success pf-m-top"
736 role="dialog"
737 aria-modal="true"
738 aria-labelledby="popover-success-alert-header"
739 aria-describedby="popover-success-alert-body"
740 >
741 <div class="pf-v6-c-popover__arrow"></div>
742 <div class="pf-v6-c-popover__content">
743 <div class="pf-v6-c-popover__close">
744 <button
745 class="pf-v6-c-button pf-m-plain"
746 type="button"
747 aria-label="Close"
748 >
749 <span class="pf-v6-c-button__icon">
750 <svg
751 class="pf-v6-svg"
752 fill="currentColor"
753 viewBox="0 0 20 20"
754 aria-hidden="true"
755 role="img"
756 width="1em"
757 height="1em"
758 >
759 <path
760 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
761 />
762 </svg>
763 </span>
764 </button>
765 </div>
766 <header class="pf-v6-c-popover__header">
767 <div class="pf-v6-c-popover__title" id="popover-success-alert-header">
768 <span class="pf-v6-c-popover__title-icon">
769 <svg
770 class="pf-v6-svg"
771 fill="currentColor"
772 viewBox="0 0 32 32"
773 aria-hidden="true"
774 role="img"
775 width="1em"
776 height="1em"
777 >
778 <path
779 d="M16 1C7.729 1 1 7.729 1 16s6.729 15 15 15 15-6.729 15-15S24.271 1 16 1Zm7.795 11.795-8.646 8.646c-.317.317-.733.475-1.149.475s-.832-.158-1.149-.475l-4.646-4.646a1.126 1.126 0 0 1 1.591-1.591l4.205 4.205 8.205-8.205a1.126 1.126 0 0 1 1.591 1.591Z"
780 />
781 </svg>
782 </span>
783 <h1 class="pf-v6-c-popover__title-text">
784 <span class="pf-v6-screen-reader">
785 Success
786 alert:
787 </span>
788 Success popover title
789 </h1>
790 </div>
791 </header>
792 <div
793 class="pf-v6-c-popover__body"
794 id="popover-success-alert-body"
795 >Popovers are triggered by click rather than hover. Click again to close.</div>
796 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
797 </div>
798 </div>
799
800 ```
801
802 ### Warning alert popover
803
804 ```html isFullscreen
805 <div
806 class="pf-v6-c-popover pf-m-warning pf-m-top"
807 role="dialog"
808 aria-modal="true"
809 aria-labelledby="popover-warning-alert-header"
810 aria-describedby="popover-warning-alert-body"
811 >
812 <div class="pf-v6-c-popover__arrow"></div>
813 <div class="pf-v6-c-popover__content">
814 <div class="pf-v6-c-popover__close">
815 <button
816 class="pf-v6-c-button pf-m-plain"
817 type="button"
818 aria-label="Close"
819 >
820 <span class="pf-v6-c-button__icon">
821 <svg
822 class="pf-v6-svg"
823 fill="currentColor"
824 viewBox="0 0 20 20"
825 aria-hidden="true"
826 role="img"
827 width="1em"
828 height="1em"
829 >
830 <path
831 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
832 />
833 </svg>
834 </span>
835 </button>
836 </div>
837 <header class="pf-v6-c-popover__header">
838 <div class="pf-v6-c-popover__title" id="popover-warning-alert-header">
839 <span class="pf-v6-c-popover__title-icon">
840 <svg
841 class="pf-v6-svg"
842 fill="currentColor"
843 viewBox="0 0 32 32"
844 aria-hidden="true"
845 role="img"
846 width="1em"
847 height="1em"
848 >
849 <path
850 d="m31.874 28.514-15.011-27a1.001 1.001 0 0 0-1.748 0l-15.011 27A1 1 0 0 0 .978 30H31a1 1 0 0 0 .874-1.486ZM14.5 12a1.5 1.5 0 0 1 3 0v5a1.5 1.5 0 0 1-3 0v-5ZM16 26.001a2 2 0 1 1-.001-3.999A2 2 0 0 1 16 26.001Z"
851 />
852 </svg>
853 </span>
854 <h1 class="pf-v6-c-popover__title-text">
855 <span class="pf-v6-screen-reader">
856 Warning
857 alert:
858 </span>
859 Warning popover title
860 </h1>
861 </div>
862 </header>
863 <div
864 class="pf-v6-c-popover__body"
865 id="popover-warning-alert-body"
866 >Popovers are triggered by click rather than hover. Click again to close.</div>
867 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
868 </div>
869 </div>
870
871 ```
872
873 ### Danger alert popover
874
875 ```html isFullscreen
876 <div
877 class="pf-v6-c-popover pf-m-danger pf-m-top"
878 role="dialog"
879 aria-modal="true"
880 aria-labelledby="popover-danger-alert-header"
881 aria-describedby="popover-danger-alert-body"
882 >
883 <div class="pf-v6-c-popover__arrow"></div>
884 <div class="pf-v6-c-popover__content">
885 <div class="pf-v6-c-popover__close">
886 <button
887 class="pf-v6-c-button pf-m-plain"
888 type="button"
889 aria-label="Close"
890 >
891 <span class="pf-v6-c-button__icon">
892 <svg
893 class="pf-v6-svg"
894 fill="currentColor"
895 viewBox="0 0 20 20"
896 aria-hidden="true"
897 role="img"
898 width="1em"
899 height="1em"
900 >
901 <path
902 d="M17.8 16.2 11.59 10l6.21-6.21c.42-.46.39-1.17-.07-1.59-.43-.4-1.09-.4-1.52 0l-6.2 6.2-6.22-6.19c-.44-.44-1.15-.44-1.59 0-.44.44-.44 1.15 0 1.59l6.2 6.21-6.2 6.2c-.42.46-.39 1.17.07 1.59.43.4 1.09.4 1.52 0L10 11.59l6.2 6.2c.44.44 1.15.44 1.59 0 .44-.45.44-1.16 0-1.6Z"
903 />
904 </svg>
905 </span>
906 </button>
907 </div>
908 <header class="pf-v6-c-popover__header">
909 <div class="pf-v6-c-popover__title" id="popover-danger-alert-header">
910 <span class="pf-v6-c-popover__title-icon">
911 <svg
912 class="pf-v6-svg"
913 fill="currentColor"
914 viewBox="0 0 32 32"
915 aria-hidden="true"
916 role="img"
917 width="1em"
918 height="1em"
919 >
920 <path
921 d="M16 1C7.729 1 1 7.729 1 16s6.729 15 15 15 15-6.729 15-15S24.271 1 16 1Zm-1.5 8a1.5 1.5 0 1 1 3 0v7a1.5 1.5 0 1 1-3 0V9ZM16 25.001a2 2 0 1 1-.001-3.999A2 2 0 0 1 16 25.001Z"
922 />
923 </svg>
924 </span>
925 <h1 class="pf-v6-c-popover__title-text">
926 <span class="pf-v6-screen-reader">
927 Danger
928 alert:
929 </span>
930 Danger popover title
931 </h1>
932 </div>
933 </header>
934 <div
935 class="pf-v6-c-popover__body"
936 id="popover-danger-alert-body"
937 >Popovers are triggered by click rather than hover. Click again to close.</div>
938 <footer class="pf-v6-c-popover__footer">Popover footer</footer>
939 </div>
940 </div>
941
942 ```
943
944 ## Documentation
945
946 ### Overview
947
948 A popover is used to provide contextual information for another component on click. The popover itself is made up of two main elements: arrow and content. The content element follows the pattern of the popover box component, with a close icon in the top right corner, as well as a header and body. One of the directional modifiers (`.pf-m-left`, `.pf-m-top`, etc.) is required on the popover component
949
950 ### Accessibility
951
952 | Attribute | Applies to | Outcome |
953 | -- | -- | -- |
954 | `role="dialog"` | `.pf-v6-c-popover` | Identifies the element that serves as the popover container. **Required** |
955 | `aria-labelledby="[id value of .pf-v6-c-title]"` | `.pf-v6-c-popover` | Gives the popover an accessible name by referring to the element that provides the dialog title. **Required when .pf-v6-c-title is present** |
956 | `aria-label="[title of popover]"` | `.pf-v6-c-popover` | Gives the popover an accessible name. **Required when .pf-v6-c-title is *not* present** |
957 | `aria-describedby="[id value of applicable content]"` | `.pf-v6-c-popover` | Gives the popover an accessible description by referring to the popover content that describes the primary message or purpose of the dialog. Not used if there is no static text that describes the popover. |
958 | `aria-modal="true"` | `.pf-v6-c-popover` | Tells assistive technologies that the windows underneath the current popover are not available for interaction. **Required**|
959 | `aria-label="Close"` | `.pf-v6-c-button` | Provides an accessible name for the close button as it uses an icon instead of text. **Required**|
960 | `aria-hidden="true"` | Parent element containing the page contents when the popover is open. | Hides main contents of the page from screen readers. The element with `.pf-v6-c-popover` must not be a descendent of the element with `aria-hidden="true"`. For more info, see [trapping focus](/accessibility/product-development-guide#trapping-focus). **Required** |
961 | `.pf-v6-screen-reader` | `.pf-v6-c-popover__title-text <span>` | Adds text to be read saying the alert status before the title. If `.pf-v6-c-popover__title-text` is not used to create a title, this must be added within the title. **Required for popovers that are alerts** |
962
963 ### Usage
964
965 | Class | Applied to | Outcome |
966 | -- | -- | -- |
967 | `.pf-v6-c-popover` | `<div>` | Creates a popover. Always use it with a modifier class that positions the popover relative to the element that triggered it. **Required** |
968 | `.pf-v6-c-popover__arrow` | `<div>` | Creates an arrow pointing towards the element the popover describes. **Required** |
969 | `.pf-v6-c-popover__content` | `<div>` | Creates the content area of the popover. **Required** |
970 | `.pf-v6-c-popover__close` | `<div>` | Positions the close icon in the top-right corner of the popover. **Required if there is a close button** |
971 | `.pf-v6-c-popover__header` | `<header>` | Creates the popover header. **Required if there is a title**|
972 | `.pf-v6-c-popover__title` | `<div>` | Creates the popover title. |
973 | `.pf-v6-c-popover__title-icon` | `<span>` | Creates the popover title icon. |
974 | `.pf-v6-c-popover__title-text` | `<h1>`,`<h2>`,`<h3>`,`<h4>`,`<h5>`,`<h6>`,`<span>` | Creates the popover title text. |
975 | `.pf-v6-c-popover__body` | `<div>` | The popover's body text. **Required** |
976 | `.pf-v6-c-popover__footer` | `<footer>` | Initiates a popover footer. |
977 | `.pf-m-left{-top/bottom}` | `.pf-v6-c-popover` | Positions the popover to the left (or left top/left bottom) of the element. |
978 | `.pf-m-right{-top/bottom}` | `.pf-v6-c-popover` | Positions the popover to the right (or right top/right bottom) of the element. |
979 | `.pf-m-top{-left/right}` | `.pf-v6-c-popover` | Positions the popover to the top (or top left/top right) of the element. |
980 | `.pf-m-bottom{-left/right}` | `.pf-v6-c-popover` | Positions the popover to the bottom (or bottom left/bottom right) of the element. |
981 | `.pf-m-no-padding` | `.pf-v6-c-popover` | Removes the outer padding from the popover content. |
982 | `.pf-m-width-auto` | `.pf-v6-c-popover` | Allows popover width to be defined by the popover content. |
983 | `.pf-m-custom` | `.pf-v6-c-popover` | Modifies for the custom alert state. |
984 | `.pf-m-info` | `.pf-v6-c-popover` | Modifies for the info alert state. |
985 | `.pf-m-success` | `.pf-v6-c-popover` | Modifies for the success alert state. |
986 | `.pf-m-warning` | `.pf-v6-c-popover` | Modifies for the warning alert state. |
987 | `.pf-m-danger` | `.pf-v6-c-popover` | Modifies for the danger alert state. |