File: ModalBox.md

package info (click to toggle)
cockpit 354-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 308,956 kB
  • sloc: javascript: 775,606; python: 40,351; ansic: 35,655; cpp: 11,117; sh: 3,511; makefile: 580; xml: 261
file content (630 lines) | stat: -rw-r--r-- 24,736 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
---
id: Modal
section: components
cssPrefix: pf-v6-c-modal-box
---import './ModalBox.css'

## Examples

### Basic

```html isFullscreen
<div
  class="pf-v6-c-modal-box"
  role="dialog"
  aria-modal="true"
  aria-labelledby="modal-title"
  aria-describedby="modal-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1 class="pf-v6-c-modal-box__title" id="modal-title">Modal title</h1>
    </div>
  </header>
  <div
    class="pf-v6-c-modal-box__body"
    id="modal-description"
  >To support screen reader user awareness of the dialog text, the dialog text is wrapped in a div that is referenced by aria-describedby.</div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### With help button

```html isFullscreen
<div
  class="pf-v6-c-modal-box"
  role="dialog"
  aria-modal="true"
  aria-labelledby="modal-help-title"
  aria-describedby="modal-help-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header pf-m-help">
    <div class="pf-v6-c-modal-box__header-main">
      <h1
        class="pf-v6-c-modal-box__title"
        id="modal-help-title"
      >Modal title Modal title Modal title Modal title Modal title Modal title Modal title Modal title</h1>
      <div
        class="pf-v6-c-modal-box__description"
        id="modal-help-description"
      >A description is used when you want to provide more info about the modal than the title is able to describe. The content in the description is static and will not scroll with the rest of the modal body.</div>
    </div>
    <div class="pf-v6-c-modal-box__header-help">
      <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Help">
        <span class="pf-v6-c-button__icon">
          <svg
            class="pf-v6-svg"
            viewBox="0 0 1024 1024"
            fill="currentColor"
            aria-hidden="true"
            role="img"
            width="1em"
            height="1em"
          >
            <path
              d="M521.3,576 C627.5,576 713.7,502 713.7,413.7 C713.7,325.4 627.6,253.6 521.3,253.6 C366,253.6 334.5,337.7 329.2,407.2 C329.2,414.3 335.2,416 343.5,416 L445,416 C450.5,416 458,415.5 460.8,406.5 C460.8,362.6 582.9,357.1 582.9,413.6 C582.9,441.9 556.2,470.9 521.3,473 C486.4,475.1 447.3,479.8 447.3,521.7 L447.3,553.8 C447.3,570.8 456.1,576 472,576 C487.9,576 521.3,576 521.3,576 M575.3,751.3 L575.3,655.3 C575.313862,651.055109 573.620137,646.982962 570.6,644 C567.638831,640.947672 563.552355,639.247987 559.3,639.29884 L463.3,639.29884 C459.055109,639.286138 454.982962,640.979863 452,644 C448.947672,646.961169 447.247987,651.047645 447.29884,655.3 L447.29884,751.3 C447.286138,755.544891 448.979863,759.617038 452,762.6 C454.961169,765.652328 459.047645,767.352013 463.3,767.30116 L559.3,767.30116 C563.544891,767.313862 567.617038,765.620137 570.6,762.6 C573.659349,759.643612 575.360354,755.553963 575.3,751.3 M512,896 C300.2,896 128,723.9 128,512 C128,300.3 300.2,128 512,128 C723.8,128 896,300.2 896,512 C896,723.8 723.7,896 512,896 M512.1,0 C229.7,0 0,229.8 0,512 C0,794.2 229.8,1024 512.1,1024 C794.4,1024 1024,794.3 1024,512 C1024,229.7 794.4,0 512.1,0"
            />
          </svg>
        </span>
      </button>
    </div>
  </header>
  <div
    class="pf-v6-c-modal-box__body"
  >To support screen reader user awareness of the dialog text, the dialog text is wrapped in a div that is referenced by aria-describedby.</div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Small

```html isFullscreen
<div
  class="pf-v6-c-modal-box pf-m-sm"
  role="dialog"
  aria-modal="true"
  aria-labelledby="modal-sm-title"
  aria-describedby="modal-sm-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1 class="pf-v6-c-modal-box__title" id="modal-sm-title">Modal title</h1>
    </div>
  </header>
  <div class="pf-v6-c-modal-box__body" id="modal-sm-description">
    Static text describing modal purpose. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat.
  </div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Medium

```html isFullscreen
<div
  class="pf-v6-c-modal-box pf-m-md"
  role="dialog"
  aria-modal="true"
  aria-labelledby="modal-md-title"
  aria-describedby="modal-md-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1 class="pf-v6-c-modal-box__title" id="modal-md-title">Modal title</h1>
    </div>
  </header>
  <div class="pf-v6-c-modal-box__body" id="modal-md-description">
    Static text describing modal purpose. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat.
  </div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Large

```html isFullscreen
<div
  class="pf-v6-c-modal-box pf-m-lg"
  role="dialog"
  aria-modal="true"
  aria-labelledby="modal-lg-title"
  aria-describedby="modal-lg-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1 class="pf-v6-c-modal-box__title" id="modal-lg-title">Modal title</h1>
    </div>
  </header>
  <div class="pf-v6-c-modal-box__body" id="modal-lg-description">
    Static text describing modal purpose. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat.
  </div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Without title

```html isFullscreen
<div
  class="pf-v6-c-modal-box"
  role="dialog"
  aria-modal="true"
  aria-label="Example of a modal without a title"
  aria-describedby="modal-no-title-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <div class="pf-v6-c-modal-box__body">
    <span
      id="modal-no-title-description"
    >When static text describing the modal is available, it can be wrapped with an ID referring to the modal's aria-describedby value. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</span> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  </div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### With description

```html isFullscreen
<div
  class="pf-v6-c-modal-box"
  role="dialog"
  aria-modal="true"
  aria-labelledby="modal-with-description-title"
  aria-describedby="modal-with-description-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1
        class="pf-v6-c-modal-box__title"
        id="modal-with-description-title"
      >Modal title</h1>
      <div
        class="pf-v6-c-modal-box__description"
        id="modal-with-description-description"
      >A description is used when you want to provide more info about the modal than the title is able to describe. The content in the description is static and will not scroll with the rest of the modal body.</div>
    </div>
  </header>
  <div
    class="pf-v6-c-modal-box__body"
  >To support screen reader user awareness of the dialog text, the dialog text is wrapped in a div that is referenced by aria-describedby.</div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Custom title

```html isFullscreen
<div
  class="pf-v6-c-modal-box"
  role="dialog"
  aria-modal="true"
  aria-labelledby="modal-custom-title"
  aria-describedby="modal-custom-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1 class="pf-v6-c-title pf-m-4xl" id="modal-custom-title">Custom title</h1>
    </div>
  </header>
  <div
    class="pf-v6-c-modal-box__body"
    id="modal-custom-description"
  >To support screen reader user awareness of the dialog text, the dialog text is wrapped in a div that is referenced by aria-describedby.</div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Modal box as generic container

```html isFullscreen
<div
  class="pf-v6-c-modal-box"
  role="dialog"
  aria-modal="true"
  aria-labelledby="modal-generic-container-description"
>
  <p
    id="modal-generic-container-description"
  >The modal box children elements can be removed, and the modal serves as a generic modal container. One use case of this is when creating a wizard in a modal.</p>
</div>

```

### Icon

```html isFullscreen
<div
  class="pf-v6-c-modal-box"
  role="dialog"
  aria-modal="true"
  aria-labelledby="icon-title"
  aria-describedby="icon-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1 class="pf-v6-c-modal-box__title pf-m-icon" id="icon-title">
        <span class="pf-v6-c-modal-box__title-icon">
          <i class="fas fa-fw fa-bullhorn" aria-hidden="true"></i>
        </span>
        <span class="pf-v6-c-modal-box__title-text">Modal with icon title</span>
      </h1>
    </div>
  </header>
  <div class="pf-v6-c-modal-box__body" id="icon-description">Modal description</div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Custom alert

```html isFullscreen
<div
  class="pf-v6-c-modal-box pf-m-custom"
  role="dialog"
  aria-modal="true"
  aria-labelledby="custom-alert-title"
  aria-describedby="custom-alert-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1 class="pf-v6-c-modal-box__title pf-m-icon" id="custom-alert-title">
        <span class="pf-v6-c-modal-box__title-icon">
          <i class="fas fa-fw fa-bell" aria-hidden="true"></i>
        </span>
        <span class="pf-v6-u-screen-reader">
          Default
          alert:
        </span>
        <span class="pf-v6-c-modal-box__title-text">Custom alert modal title</span>
      </h1>
    </div>
  </header>
  <div
    class="pf-v6-c-modal-box__body"
    id="custom-alert-description"
  >Modal description</div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Info alert

```html isFullscreen
<div
  class="pf-v6-c-modal-box pf-m-info"
  role="dialog"
  aria-modal="true"
  aria-labelledby="info-alert-title"
  aria-describedby="info-alert-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1 class="pf-v6-c-modal-box__title pf-m-icon" id="info-alert-title">
        <span class="pf-v6-c-modal-box__title-icon">
          <i class="fas fa-fw fa-info-circle" aria-hidden="true"></i>
        </span>
        <span class="pf-v6-u-screen-reader">
          Info
          alert:
        </span>
        <span class="pf-v6-c-modal-box__title-text">Info alert modal title</span>
      </h1>
    </div>
  </header>
  <div
    class="pf-v6-c-modal-box__body"
    id="info-alert-description"
  >Modal description</div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Success alert

```html isFullscreen
<div
  class="pf-v6-c-modal-box pf-m-success"
  role="dialog"
  aria-modal="true"
  aria-labelledby="success-alert-title"
  aria-describedby="success-alert-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1 class="pf-v6-c-modal-box__title pf-m-icon" id="success-alert-title">
        <span class="pf-v6-c-modal-box__title-icon">
          <i class="fas fa-fw fa-check-circle" aria-hidden="true"></i>
        </span>
        <span class="pf-v6-u-screen-reader">
          Success
          alert:
        </span>
        <span class="pf-v6-c-modal-box__title-text">Success alert modal title</span>
      </h1>
    </div>
  </header>
  <div
    class="pf-v6-c-modal-box__body"
    id="success-alert-description"
  >Modal description</div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Warning alert

```html isFullscreen
<div
  class="pf-v6-c-modal-box pf-m-warning"
  role="dialog"
  aria-modal="true"
  aria-labelledby="warning-alert-title"
  aria-describedby="warning-alert-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1 class="pf-v6-c-modal-box__title pf-m-icon" id="warning-alert-title">
        <span class="pf-v6-c-modal-box__title-icon">
          <i class="fas fa-fw fa-exclamation-triangle" aria-hidden="true"></i>
        </span>
        <span class="pf-v6-u-screen-reader">
          Warning
          alert:
        </span>
        <span class="pf-v6-c-modal-box__title-text">Warning alert modal title</span>
      </h1>
    </div>
  </header>
  <div
    class="pf-v6-c-modal-box__body"
    id="warning-alert-description"
  >Modal description</div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Danger alert

```html isFullscreen
<div
  class="pf-v6-c-modal-box pf-m-danger"
  role="dialog"
  aria-modal="true"
  aria-labelledby="danger-alert-title"
  aria-describedby="danger-alert-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1 class="pf-v6-c-modal-box__title pf-m-icon" id="danger-alert-title">
        <span class="pf-v6-c-modal-box__title-icon">
          <i class="fas fa-fw fa-exclamation-circle" aria-hidden="true"></i>
        </span>
        <span class="pf-v6-u-screen-reader">
          Danger
          alert:
        </span>
        <span class="pf-v6-c-modal-box__title-text">Danger alert modal title</span>
      </h1>
    </div>
  </header>
  <div
    class="pf-v6-c-modal-box__body"
    id="danger-alert-description"
  >To support screen reader user awareness of the dialog text, the dialog text is wrapped in a div that is referenced by aria-describedby.</div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

### Danger alert with modifier on modal title

The status modifier classes can be applied directly to the modal title element, instead of the parent modal.

```html isFullscreen
<div
  class="pf-v6-c-modal-box"
  role="dialog"
  aria-modal="true"
  aria-labelledby="danger-alert-title-title"
  aria-describedby="danger-alert-title-description"
>
  <div class="pf-v6-c-modal-box__close">
    <button class="pf-v6-c-button pf-m-plain" type="button" aria-label="Close">
      <span class="pf-v6-c-button__icon">
        <i class="fas fa-times" aria-hidden="true"></i>
      </span>
    </button>
  </div>
  <header class="pf-v6-c-modal-box__header">
    <div class="pf-v6-c-modal-box__header-main">
      <h1
        class="pf-v6-c-modal-box__title pf-m-icon pf-m-danger"
        id="danger-alert-title-title"
      >
        <span class="pf-v6-c-modal-box__title-icon">
          <i class="fas fa-fw fa-exclamation-circle" aria-hidden="true"></i>
        </span>
        <span class="pf-v6-u-screen-reader">
          Danger
          alert:
        </span>
        <span class="pf-v6-c-modal-box__title-text">Danger alert modal title</span>
      </h1>
    </div>
  </header>
  <div
    class="pf-v6-c-modal-box__body"
    id="danger-alert-title-description"
  >To support screen reader user awareness of the dialog text, the dialog text is wrapped in a div that is referenced by aria-describedby.</div>
  <footer class="pf-v6-c-modal-box__footer">Modal footer</footer>
</div>

```

## Documentation

### Overview

A modal box is a generic rectangular container that can be used to build modals. A modal box can have the following sections: header, title, description, body, and footer. With normal use of the modal, a title or body is required. Alternatively, no child elements can be used, and the `.pf-v6-c-modal-box` container will  serve as a generic container with no padding for custom modal content. If no `.pf-v6-c-modal-box__title` is used, `aria-label="[title of modal]"` must be provided for `.pf-v6-c-modal-box`.

### Accessibility

| Attribute | Applies to | Outcome |
| -- | -- | -- |
| `role="dialog"` | `.pf-v6-c-modal-box` | Identifies the element that serves as the modal container. **Required** |
| `aria-labelledby="[id value of .pf-v6-c-modal-box__title or custom modal title]"` | `.pf-v6-c-modal-box` | Gives the modal an accessible name by referring to the element that provides the dialog title. **Required when .pf-v6-c-title is present** |
| `aria-label="[title of modal]"` | `.pf-v6-c-modal-box` | Gives the modal an accessible name. **Required when `.pf-v6-c-modal-box__title` is *not* present** |
| `aria-describedby="[id value of applicable content]"` | `.pf-v6-c-modal-box` | Gives the modal an accessible description by referring to the modal content that describes the primary message or purpose of the dialog. Not used if there is no static text that describes the modal. |
| `aria-modal="true"` | `.pf-v6-c-modal-box` | Tells assistive technologies that the windows underneath the current modal are not available for interaction. **Required**|
| `aria-label="Close"` | `.pf-v6-c-modal-box__close .pf-v6-c-button` | Provides an accessible name for the close button as it uses an icon instead of text. **Required**|
| `aria-hidden="true"` | Parent element containing the page contents when modal is open | Hides main contents of the page from screen readers. The element with `.pf-v6-c-modal-box` 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** |
| `form="[id of form in modal body]"` | `.pf-v6-c-modal-box__footer .pf-v6-c-button` | Associates a submit button in the modal footer with a form in the modal body. For use when the submit button is outside of the `<form>` that the button submits. |
| `tabindex="0"` | `.pf-v6-c-modal-box__body` | If a modal box body has overflow content that triggers a scrollbar, to ensure that the content is keyboard accessible, the body must include either a focusable element within the scrollable region or the body itself must be focusable by adding `tabindex="0"`. |

### Usage

| Class | Applied | Outcome |
| -- | -- | -- |
| `.pf-v6-c-modal-box` | `<div>` | Initiates a modal box. **Required** |
| `.pf-v6-c-modal-box__close` | `<div>` | Creates a container for the modal box close button. **Required** if there is a close button. |
| `.pf-v6-c-button.pf-m-plain` | `<button>` | Initiates a modal box close button. |
| `.pf-v6-c-modal-box__header` | `<header>` | Initiates a modal box header. **Required** if using a `.pf-v6-c-modal-box__title`. |
| `.pf-v6-c-modal-box__header-main` | `<div>` | Initiates a modal box header main container. **Required** when using a modal header. |
| `.pf-v6-c-modal-box__header-help` | `<div>` | Initiates the help button container in the modal box header actions. |
| `.pf-v6-c-modal-box__title` | `<h1>`,`<h2>`,`<h3>`,`<h4>`,`<h5>`,`<h6>`, `<div>` | Initiates a modal box title. **Required** if using a modal description. |
| `.pf-v6-c-modal-box__title-icon` | `<span>` | Initiates a container for the modal box title icon. |
| `.pf-v6-c-modal-box__title-text` | `<span>` | Initiates a container for the modal box title text. |
| `.pf-v6-c-modal-box__description` | `<div>` | Initiates a modal box description. |
| `.pf-v6-c-modal-box__body` | `<div>` | Initiates a modal box body. |
| `.pf-v6-c-modal-box__footer` | `<footer>` | Initiates a modal box footer. |
| `.pf-m-sm` | `.pf-v6-c-modal-box` | Modifies for a small modal box width. |
| `.pf-m-md` | `.pf-v6-c-modal-box` | Modifies for a medium modal box width. |
| `.pf-m-lg` | `.pf-v6-c-modal-box` | Modifies for a large modal box width. |
| `.pf-m-align-top` | `.pf-v6-c-modal-box` | Modifies for top alignment.  |
| `.pf-m-icon` | `.pf-v6-c-modal-box__title` | Modifies the title layout to accommodate an icon. |
| `.pf-m-custom` | `.pf-v6-c-modal-box`, `.pf-v6-c-modal-box__title` | Modifies for the custom alert state. |
| `.pf-m-info` | `.pf-v6-c-modal-box`, `.pf-v6-c-modal-box__title` | Modifies for the info alert state. |
| `.pf-m-success` | `.pf-v6-c-modal-box`, `.pf-v6-c-modal-box__title` | Modifies for the success alert state. |
| `.pf-m-warning` | `.pf-v6-c-modal-box`, `.pf-v6-c-modal-box__title` | Modifies for the warning alert state. |
| `.pf-m-danger` | `.pf-v6-c-modal-box`, `.pf-v6-c-modal-box__title` | Modifies for the danger alert state. |
| `.pf-m-help` | `.pf-v6-c-modal-box__header` | Modifies the modal box header to support the help action |