@iress-oss/ids-mcp-server 6.0.0-alpha.1-canary-20251204032753-fe18cab → 6.0.0-alpha.1-canary-20251204040305-3639454

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/generated/docs/components_components-alert-docs.md +1054 -0
  2. package/generated/docs/components_components-autocomplete-docs.md +3304 -0
  3. package/generated/docs/components_components-autocomplete-recipes-docs.md +98 -0
  4. package/generated/docs/components_components-badge-docs.md +312 -0
  5. package/generated/docs/components_components-button-docs.md +2339 -0
  6. package/generated/docs/components_components-buttongroup-docs.md +980 -0
  7. package/generated/docs/components_components-card-docs.md +1970 -0
  8. package/generated/docs/components_components-checkbox-docs.md +1083 -0
  9. package/generated/docs/components_components-checkboxgroup-docs.md +1597 -0
  10. package/generated/docs/components_components-checkboxgroup-recipes-docs.md +209 -0
  11. package/generated/docs/components_components-col-docs.md +755 -0
  12. package/generated/docs/components_components-container-docs.md +172 -0
  13. package/generated/docs/components_components-divider-docs.md +235 -0
  14. package/generated/docs/components_components-expander-docs.md +428 -0
  15. package/generated/docs/components_components-field-docs.md +3345 -0
  16. package/generated/docs/components_components-filter-docs.md +4091 -0
  17. package/generated/docs/components_components-hide-docs.md +450 -0
  18. package/generated/docs/components_components-icon-docs.md +1017 -0
  19. package/generated/docs/components_components-image-docs.md +168 -0
  20. package/generated/docs/components_components-inline-docs.md +1962 -0
  21. package/generated/docs/components_components-input-docs.md +1388 -0
  22. package/generated/docs/components_components-input-recipes-docs.md +349 -0
  23. package/generated/docs/components_components-inputcurrency-docs.md +636 -0
  24. package/generated/docs/components_components-inputcurrency-recipes-docs.md +208 -0
  25. package/generated/docs/components_components-introduction-docs.md +448 -0
  26. package/generated/docs/components_components-label-docs.md +229 -0
  27. package/generated/docs/components_components-link-docs.md +454 -0
  28. package/generated/docs/components_components-menu-docs.md +2219 -0
  29. package/generated/docs/components_components-menu-menuitem-docs.md +1455 -0
  30. package/generated/docs/components_components-modal-docs.md +2002 -0
  31. package/generated/docs/components_components-panel-docs.md +342 -0
  32. package/generated/docs/components_components-placeholder-docs.md +98 -0
  33. package/generated/docs/components_components-popover-docs.md +1631 -0
  34. package/generated/docs/components_components-popover-recipes-docs.md +537 -0
  35. package/generated/docs/components_components-progress-docs.md +128 -0
  36. package/generated/docs/components_components-provider-docs.md +123 -0
  37. package/generated/docs/components_components-radio-docs.md +499 -0
  38. package/generated/docs/components_components-radiogroup-docs.md +1573 -0
  39. package/generated/docs/components_components-readonly-docs.md +277 -0
  40. package/generated/docs/components_components-richselect-docs.md +6101 -0
  41. package/generated/docs/components_components-row-docs.md +2172 -0
  42. package/generated/docs/components_components-select-docs.md +1110 -0
  43. package/generated/docs/components_components-skeleton-docs.md +467 -0
  44. package/generated/docs/components_components-skeleton-recipes-docs.md +110 -0
  45. package/generated/docs/components_components-skiplink-docs.md +220 -0
  46. package/generated/docs/components_components-slideout-docs.md +1910 -0
  47. package/generated/docs/components_components-slider-docs.md +1284 -0
  48. package/generated/docs/components_components-spinner-docs.md +90 -0
  49. package/generated/docs/components_components-stack-docs.md +730 -0
  50. package/generated/docs/components_components-table-docs.md +4038 -0
  51. package/generated/docs/components_components-tabset-docs.md +955 -0
  52. package/generated/docs/components_components-tabset-tab-docs.md +342 -0
  53. package/generated/docs/components_components-tag-docs.md +410 -0
  54. package/generated/docs/components_components-text-docs.md +593 -0
  55. package/generated/docs/components_components-toaster-docs.md +451 -0
  56. package/generated/docs/components_components-toggle-docs.md +513 -0
  57. package/generated/docs/components_components-tooltip-docs.md +564 -0
  58. package/generated/docs/components_components-validationmessage-docs.md +608 -0
  59. package/generated/docs/components_contact-us-docs.md +9 -0
  60. package/generated/docs/components_foundations-accessibility-docs.md +33 -0
  61. package/generated/docs/components_foundations-consistency-docs.md +44 -0
  62. package/generated/docs/components_foundations-content-docs.md +18 -0
  63. package/generated/docs/components_foundations-introduction-docs.md +17 -0
  64. package/generated/docs/components_foundations-principles-docs.md +60 -0
  65. package/generated/docs/components_foundations-responsive-layout-docs.md +2692 -0
  66. package/generated/docs/components_foundations-user-experience-docs.md +53 -0
  67. package/generated/docs/components_foundations-visual-design-docs.md +39 -0
  68. package/generated/docs/components_foundations-z-index-stacking-docs.md +288 -0
  69. package/generated/docs/components_frequently-asked-questions-docs.md +44 -0
  70. package/generated/docs/components_get-started-develop-docs.md +47 -0
  71. package/generated/docs/components_get-started-using-storybook-docs.md +55 -0
  72. package/generated/docs/components_introduction-docs.md +85 -0
  73. package/generated/docs/components_patterns-form-docs.md +2469 -0
  74. package/generated/docs/components_patterns-form-recipes-docs.md +1597 -0
  75. package/generated/docs/components_patterns-introduction-docs.md +31 -0
  76. package/generated/docs/components_patterns-loading-docs.md +1908 -0
  77. package/generated/docs/components_patterns-shadow-docs.md +195 -0
  78. package/generated/docs/components_resources-code-katas-docs.md +25 -0
  79. package/generated/docs/components_resources-introduction-docs.md +28 -0
  80. package/generated/docs/components_resources-mcp-server-docs.md +23 -0
  81. package/generated/docs/components_resources-migration-guides-from-v4-to-v5-docs.md +142 -0
  82. package/generated/docs/components_styling-props-colour-docs.md +91 -0
  83. package/generated/docs/components_styling-props-elevation-docs.md +69 -0
  84. package/generated/docs/components_styling-props-radius-docs.md +63 -0
  85. package/generated/docs/components_styling-props-reference-docs.md +160 -0
  86. package/generated/docs/components_styling-props-screen-readers-docs.md +66 -0
  87. package/generated/docs/components_styling-props-sizing-docs.md +217 -0
  88. package/generated/docs/components_styling-props-spacing-docs.md +545 -0
  89. package/generated/docs/components_styling-props-typography-docs.md +66 -0
  90. package/generated/docs/components_versions-docs.md +14 -0
  91. package/generated/docs/guidelines.md +3083 -0
  92. package/generated/docs/introduction-docs.md +37 -0
  93. package/generated/docs/tokens_colour-docs.md +479 -0
  94. package/generated/docs/tokens_elevation-docs.md +39 -0
  95. package/generated/docs/tokens_introduction-docs.md +150 -0
  96. package/generated/docs/tokens_radius-docs.md +67 -0
  97. package/generated/docs/tokens_spacing-docs.md +87 -0
  98. package/generated/docs/tokens_typography-docs.md +305 -0
  99. package/package.json +2 -2
@@ -0,0 +1,2002 @@
1
+ Modal
2
+ =====
3
+
4
+ Overview
5
+ --------
6
+
7
+ Modals gather information, complete a subtask, or provide additional information without losing the context of an underlying page.
8
+
9
+ * * *
10
+
11
+ Updated
12
+
13
+ **Recently updated**
14
+
15
+ This component has been recently updated with new props. The props have been marked as beta. Please tell us if there are any issues.
16
+
17
+ Read more
18
+
19
+ [](#use-a-modal-when)Use a modal when
20
+ -------------------------------------
21
+
22
+ * Providing supplemental tasks required by the underlying page
23
+ * Providing non-essential information related to the underlying page
24
+ * Content require full attention
25
+
26
+ [](#avoid-using-a-modal-when)Avoid using a modal when
27
+ -----------------------------------------------------
28
+
29
+ * Conveying brief messages about background processes or status changes. Instead use IressAlert or IressToast.
30
+ * The modal content can be incorporated into the page without complicating the page's intent
31
+
32
+ [](./iframe.html?id=components-modal--default)
33
+
34
+ Show modal
35
+
36
+ ```
37
+
38
+ const Story \= () \=> {
39
+ const { showModal } \= useModal();
40
+ const MODAL\_ID \= 'storybook-modal';
41
+ return (
42
+ const Story \= () \=> {
43
+ const { showModal } \= useModal();
44
+ const MODAL\_ID \= 'storybook-modal';
45
+ return (
46
+ <\>
47
+ <IressButton onClick\={() \=> showModal(MODAL\_ID)}\>
48
+ Show modal </IressButton\>
49
+ <IressModal
50
+ footer\="Footer slot"
51
+ id\="storybook-modal"
52
+ \>
53
+ Modal content </IressModal\>
54
+ </\>
55
+ );
56
+ };
57
+
58
+ export const App \= () \=> (
59
+ <IressModalProvider\>
60
+ <Story />
61
+ </IressModalProvider\>
62
+ );
63
+ );
64
+ };
65
+
66
+ export const App \= () \=> (
67
+ <IressModalProvider\>
68
+ <Story />
69
+ </IressModalProvider\>
70
+ );
71
+
72
+ ```
73
+
74
+ Props
75
+ -----
76
+
77
+ | Name | Description | Default | Control |
78
+ | --- | --- | --- | --- |
79
+ | children |
80
+ Text to be displayed inside the modal.
81
+
82
+ ReactNode
83
+
84
+
85
+
86
+ | \- |
87
+
88
+ "Modal content"
89
+
90
+ |
91
+ | closeText |
92
+
93
+ Screenreader text for close button.
94
+
95
+ string
96
+
97
+
98
+
99
+ | \- | Set string |
100
+ | container |
101
+
102
+ The container element to render the modal into. By default, the modal will render at the end of the document body.
103
+
104
+ FloatingUIContainer
105
+
106
+
107
+
108
+ | \- | Set object |
109
+ | defaultShow |
110
+
111
+ When set to `true` the modal will be visible by default. Use for uncontrolled modals.
112
+
113
+ boolean
114
+
115
+
116
+
117
+ |
118
+
119
+ false
120
+
121
+ | Set boolean |
122
+ | disableBackdropClick |
123
+
124
+ When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
125
+
126
+ boolean
127
+
128
+
129
+
130
+ | \- | Set boolean |
131
+ | fixedFooter |
132
+
133
+ When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
134
+
135
+ boolean
136
+
137
+
138
+
139
+ | \- | Set boolean |
140
+ | footer |
141
+
142
+ Panel to place modal controls.
143
+
144
+ ReactNode
145
+
146
+
147
+
148
+ | \- |
149
+
150
+ "Footer slot"
151
+
152
+ |
153
+ | heading |
154
+
155
+ Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
156
+
157
+ union
158
+
159
+
160
+
161
+ | \- | Set object |
162
+ | id |
163
+
164
+ Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
165
+
166
+ string
167
+
168
+
169
+
170
+ | \- | storybook-modal |
171
+ | noCloseButton |
172
+
173
+ When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
174
+
175
+ boolean
176
+
177
+
178
+
179
+ | \- | Set boolean |
180
+ | onEntered |
181
+
182
+ Emitted when the modal has opened.
183
+
184
+ () => void
185
+
186
+ | \- | \- |
187
+ | onExited |
188
+
189
+ Emitted when the modal has closed.
190
+
191
+ () => void
192
+
193
+ | \- | \- |
194
+ | onShowChange |
195
+
196
+ Emitted when the modal has opened or closed internally. Use for controlled modals.
197
+
198
+ (show: boolean) => void
199
+
200
+ | \- | \- |
201
+ | onStatus |
202
+
203
+ Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
204
+
205
+ (status: 'unmounted' | 'initial' | 'open' | 'close') => void
206
+
207
+ | \- | \- |
208
+ | show |
209
+
210
+ When set to `true` the modal will be visible. Use for controlled modals.
211
+
212
+ boolean
213
+
214
+
215
+
216
+ | \- | \- |
217
+ | static |
218
+
219
+ When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
220
+
221
+ boolean
222
+
223
+
224
+
225
+ | \- | Set boolean |
226
+
227
+ Controlling the modal
228
+ ---------------------
229
+
230
+ ### Using the `show` property
231
+
232
+ You can use state to control the modal by setting the `show` property to `true` or `false`. To sync your state with the modal, you can use the `onShowChange` prop, which is normally passed the set function from `useState`.
233
+
234
+ [](./iframe.html?id=components-modal--show-with-state)
235
+
236
+ Show modal using state
237
+
238
+ ```
239
+
240
+ import { IressButton, IressModal, type IressModalProps } from '@iress-oss/ids-components';
241
+ import { useState } from 'react';
242
+ export const ModalUsingState \= () \=> {
243
+ const \[show, setShow\] \= useState(false);
244
+ return (
245
+ <\>
246
+ <IressButton onClick\={() \=> setShow(true)}\>
247
+ Show modal using state </IressButton\>
248
+ <IressModal
249
+ {...{
250
+ children: 'This modal was opened via state',
251
+ }}
252
+ show\={show}
253
+ onShowChange\={setShow}
254
+ footer\={<IressButton onClick\={() \=> setShow(false)}\>Close</IressButton\>}
255
+ />
256
+ </\>
257
+ );
258
+ };
259
+
260
+ ```
261
+
262
+ #### Props
263
+
264
+ | Name | Description | Default | Control |
265
+ | --- | --- | --- | --- |
266
+ | children |
267
+ Text to be displayed inside the modal.
268
+
269
+ ReactNode
270
+
271
+
272
+
273
+ | \- |
274
+
275
+ "This modal was opened via state"
276
+
277
+ |
278
+ | closeText |
279
+
280
+ Screenreader text for close button.
281
+
282
+ string
283
+
284
+
285
+
286
+ | \- | Set string |
287
+ | container |
288
+
289
+ The container element to render the modal into. By default, the modal will render at the end of the document body.
290
+
291
+ FloatingUIContainer
292
+
293
+
294
+
295
+ | \- | Set object |
296
+ | defaultShow |
297
+
298
+ When set to `true` the modal will be visible by default. Use for uncontrolled modals.
299
+
300
+ boolean
301
+
302
+
303
+
304
+ |
305
+
306
+ false
307
+
308
+ | Set boolean |
309
+ | disableBackdropClick |
310
+
311
+ When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
312
+
313
+ boolean
314
+
315
+
316
+
317
+ | \- | Set boolean |
318
+ | fixedFooter |
319
+
320
+ When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
321
+
322
+ boolean
323
+
324
+
325
+
326
+ | \- | Set boolean |
327
+ | footer |
328
+
329
+ Panel to place modal controls.
330
+
331
+ ReactNode
332
+
333
+
334
+
335
+ | \- | \- |
336
+ | heading |
337
+
338
+ Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
339
+
340
+ union
341
+
342
+
343
+
344
+ | \- | Set object |
345
+ | id |
346
+
347
+ Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
348
+
349
+ string
350
+
351
+
352
+
353
+ | \- | Set string |
354
+ | noCloseButton |
355
+
356
+ When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
357
+
358
+ boolean
359
+
360
+
361
+
362
+ | \- | Set boolean |
363
+ | onEntered |
364
+
365
+ Emitted when the modal has opened.
366
+
367
+ () => void
368
+
369
+ | \- | \- |
370
+ | onExited |
371
+
372
+ Emitted when the modal has closed.
373
+
374
+ () => void
375
+
376
+ | \- | \- |
377
+ | onShowChange |
378
+
379
+ Emitted when the modal has opened or closed internally. Use for controlled modals.
380
+
381
+ (show: boolean) => void
382
+
383
+ | \- | \- |
384
+ | onStatus |
385
+
386
+ Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
387
+
388
+ (status: 'unmounted' | 'initial' | 'open' | 'close') => void
389
+
390
+ | \- | \- |
391
+ | show |
392
+
393
+ When set to `true` the modal will be visible. Use for controlled modals.
394
+
395
+ boolean
396
+
397
+
398
+
399
+ | \- | \- |
400
+ | static |
401
+
402
+ When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
403
+
404
+ boolean
405
+
406
+
407
+
408
+ | \- | Set boolean |
409
+
410
+ ### Using the `IressModalProvider`
411
+
412
+ You can use the `IressModalProvider` to open and close modals from anywhere in your application, as long as the modal has a unique `id`. In this case you would use the `useModal` hook to open and close the modal.
413
+
414
+ To use, wrap your `<App/>` or the component that you want to use the `useModal` hook with `<IressModalProvider />`.
415
+
416
+ [](./iframe.html?id=components-modal-provider--provider)
417
+
418
+ Show modal using provider
419
+
420
+ ```
421
+
422
+ import {
423
+ IressButton,
424
+ IressModal,
425
+ type IressModalProps,
426
+ IressModalProvider,
427
+ useModal,
428
+ } from '@iress-oss/ids-components';
429
+ const MODAL\_ID \= 'storybook-modal';
430
+ export const App \= (modalProps: IressModalProps) \=> (
431
+ <IressModalProvider\>
432
+ <ModalWithTrigger {...modalProps} />
433
+ </IressModalProvider\>
434
+ );
435
+ const ModalWithTrigger \= ({
436
+ id \= MODAL\_ID,
437
+ ...modalProps
438
+ }: IressModalProps) \=> {
439
+ const { showModal } \= useModal();
440
+ return (
441
+ <\>
442
+ <IressButton onClick\={() \=> showModal(id)}\>
443
+ Show modal using provider </IressButton\>
444
+ <IressModal
445
+ {...modalProps}
446
+ id\={id}
447
+ footer\={
448
+ <IressButton onClick\={() \=> showModal(id, false)}\>Close</IressButton\>
449
+ }
450
+ \>
451
+ {modalProps.children ?? 'Modal content'}
452
+ </IressModal\>
453
+ </\>
454
+ );
455
+ };
456
+
457
+ ```
458
+
459
+ #### Props
460
+
461
+ These are some settings you can use to customise the provider, such as setting where the modals are rendered in the DOM.
462
+
463
+ | Name | Description | Default | Control |
464
+ | --- | --- | --- | --- |
465
+ | children |
466
+ \-
467
+
468
+ | \- | \- |
469
+ | container |
470
+
471
+ The container element to render the modal into. By default, the modal will render at the end of the document body.
472
+
473
+ FloatingUIContainer
474
+
475
+
476
+
477
+ | \- | \- |
478
+ | Show Storybook only itemsStorybook only | Show Storybook only items |
479
+
480
+ Behaviour
481
+ ---------
482
+
483
+ * No other interaction on the main page can be accessed while a modal is active. A backdrop covers the content beneath so that the content beneath cannot be interacted with.
484
+ * Clicking on the the backdrop closes the modal and returns the focus to the triggering element.
485
+ * When the modal is active the body is set to overflow: hidden to stop any scrolling of the underlying page. Scrolling should then only be possible on the modal wrapper.
486
+ * By default there are 3 ways to dismiss the modal; click X in the header; press ESC on a keyboard; click anywhere on the backdrop. It is also recommended that consumers add a Cancel or Close button to the modal's footer slot if required.
487
+
488
+ Examples
489
+ --------
490
+
491
+ ### Footer slot
492
+
493
+ Content to appear underneath the main content. Usually used for extra controls like buttons etc.
494
+
495
+ [](./iframe.html?id=components-modal--footer-slot)
496
+
497
+ Footer slot modal
498
+
499
+ ```
500
+
501
+ const Story \= () \=> {
502
+ const { showModal } \= useModal();
503
+ const MODAL\_ID \= 'storybook-modal';
504
+ return (
505
+ const Story \= () \=> {
506
+ const { showModal } \= useModal();
507
+ const MODAL\_ID \= 'storybook-modal';
508
+ return (
509
+ <\>
510
+ <IressButton onClick\={() \=> showModal(MODAL\_ID)}\>
511
+ Footer slot modal </IressButton\>
512
+ <IressModal
513
+ footer\={<IressButton\>Button in footer</IressButton\>}
514
+ id\="storybook-modal"
515
+ \>
516
+ Normal modal content </IressModal\>
517
+ </\>
518
+ );
519
+ };
520
+
521
+ export const App \= () \=> (
522
+ <IressModalProvider\>
523
+ <Story />
524
+ </IressModalProvider\>
525
+ );
526
+ );
527
+ };
528
+
529
+ export const App \= () \=> (
530
+ <IressModalProvider\>
531
+ <Story />
532
+ </IressModalProvider\>
533
+ );
534
+
535
+ ```
536
+
537
+ #### Props
538
+
539
+ | Name | Description | Default | Control |
540
+ | --- | --- | --- | --- |
541
+ | children |
542
+ Text to be displayed inside the modal.
543
+
544
+ ReactNode
545
+
546
+
547
+
548
+ | \- |
549
+
550
+ "Normal modal content"
551
+
552
+ |
553
+ | closeText |
554
+
555
+ Screenreader text for close button.
556
+
557
+ string
558
+
559
+
560
+
561
+ | \- | Set string |
562
+ | container |
563
+
564
+ The container element to render the modal into. By default, the modal will render at the end of the document body.
565
+
566
+ FloatingUIContainer
567
+
568
+
569
+
570
+ | \- | Set object |
571
+ | defaultShow |
572
+
573
+ When set to `true` the modal will be visible by default. Use for uncontrolled modals.
574
+
575
+ boolean
576
+
577
+
578
+
579
+ |
580
+
581
+ false
582
+
583
+ | Set boolean |
584
+ | disableBackdropClick |
585
+
586
+ When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
587
+
588
+ boolean
589
+
590
+
591
+
592
+ | \- | Set boolean |
593
+ | fixedFooter |
594
+
595
+ When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
596
+
597
+ boolean
598
+
599
+
600
+
601
+ | \- | Set boolean |
602
+ | footer |
603
+
604
+ Panel to place modal controls.
605
+
606
+ ReactNode
607
+
608
+
609
+
610
+ | \- | \- |
611
+ | heading |
612
+
613
+ Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
614
+
615
+ union
616
+
617
+
618
+
619
+ | \- | Set object |
620
+ | id |
621
+
622
+ Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
623
+
624
+ string
625
+
626
+
627
+
628
+ | \- | storybook-modal |
629
+ | noCloseButton |
630
+
631
+ When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
632
+
633
+ boolean
634
+
635
+
636
+
637
+ | \- | Set boolean |
638
+ | onEntered |
639
+
640
+ Emitted when the modal has opened.
641
+
642
+ () => void
643
+
644
+ | \- | \- |
645
+ | onExited |
646
+
647
+ Emitted when the modal has closed.
648
+
649
+ () => void
650
+
651
+ | \- | \- |
652
+ | onShowChange |
653
+
654
+ Emitted when the modal has opened or closed internally. Use for controlled modals.
655
+
656
+ (show: boolean) => void
657
+
658
+ | \- | \- |
659
+ | onStatus |
660
+
661
+ Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
662
+
663
+ (status: 'unmounted' | 'initial' | 'open' | 'close') => void
664
+
665
+ | \- | \- |
666
+ | show |
667
+
668
+ When set to `true` the modal will be visible. Use for controlled modals.
669
+
670
+ boolean
671
+
672
+
673
+
674
+ | \- | \- |
675
+ | static |
676
+
677
+ When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
678
+
679
+ boolean
680
+
681
+
682
+
683
+ | \- | Set boolean |
684
+
685
+ ### Fixed footer
686
+
687
+ The `fixedFooter` prop can be used to set the footer to be fixed to the bottom of the modal. This is often useful when there is a lot of content in the main area that you would like to scroll underneath the footer content.
688
+
689
+ **Note:** Also works without footer content.
690
+
691
+ Using with popovers and tooltips
692
+ --------------------------------
693
+
694
+ The fixed footer variant of IressModal prevents content from overflowing the modal. This can cause layout issues when using with components that use popovers (for example IressCombobox), especially when these components sit at the end of the modal's content. If you encounter these issues, try using a modal without a fixed footer. Normal modals allow content to overflow, which should fix the issue.
695
+
696
+ [](./iframe.html?id=components-modal--fixed-footer)
697
+
698
+ Fixed footer modal
699
+
700
+ ```
701
+
702
+ const Story \= () \=> {
703
+ const { showModal } \= useModal();
704
+ const MODAL\_ID \= 'storybook-modal';
705
+ return (
706
+ const Story \= () \=> {
707
+ const { showModal } \= useModal();
708
+ const MODAL\_ID \= 'storybook-modal';
709
+ return (
710
+ <\>
711
+ <IressButton onClick\={() \=> showModal(MODAL\_ID)}\>
712
+ Fixed footer modal </IressButton\>
713
+ <IressModal
714
+ fixedFooter
715
+ footer\={<IressButton\>Button in footer</IressButton\>}
716
+ id\="storybook-modal"
717
+ \>
718
+ <React.Fragment key\=".0"\>
719
+ <IressText element\="h2"\>
720
+ Next Saturday night, we're sending you back to the future </IressText\>
721
+ <IressText\>
722
+ <p\>
723
+ I still don't understand, how am I supposed to go to the dance with her, if she's already going to the dance with you. Alright, okay Jennifer. What if I send in the tape and they don't like it. I mean, what if they say I'm no good. What if they say, 'Get out of here, kid, you got no future.' I mean, I just don't think I can take that kind of rejection. Jesus, I'm beginning to sound like my old man. Ahh. Alright, take it up, go. Doc. This is it. This is the answer. It says here that a bolt of lightning is gonna strike the clock tower precisely at 10:04 p.m. next Saturday night. If we could somehow harness this bolt of lightning, channel it into the flux capacitor, it just might work. Next Saturday night, we're sending you back to the future. </p\>
724
+ <p\>
725
+ Go. Yeah, it's in the back. The future, it's where you're going? Mother, with Marty's parents out of town, don't you think he oughta spend the night, after all, Dad almost killed him with the car. What's going on? Where have you been all week? </p\>
726
+ <p\>
727
+ But I can't go to the dance, I'll miss my favorite television program, Science Fiction Theater. Well uh, good, fine. Ahh. Ahh. Right, okay, so right around 9:00 she's gonna get very angry with me. That's right. </p\>
728
+ <h3\>
729
+ I just don't think I can take that kind of rejection </h3\>
730
+ <p\>
731
+ I still don't understand, how am I supposed to go to the dance with her, if she's already going to the dance with you. Alright, okay Jennifer. What if I send in the tape and they don't like it. I mean, what if they say I'm no good. What if they say, 'Get out of here, kid, you got no future.' I mean, I just don't think I can take that kind of rejection. Jesus, I'm beginning to sound like my old man. Ahh. Alright, take it up, go. Doc. This is it. This is the answer. It says here that a bolt of lightning is gonna strike the clock tower precisely at 10:04 p.m. next Saturday night. If we could somehow harness this bolt of lightning, channel it into the flux capacitor, it just might work. Next Saturday night, we're sending you back to the future. </p\>
732
+ <p\>
733
+ Go. Yeah, it's in the back. The future, it's where you're going? Mother, with Marty's parents out of town, don't you think he oughta spend the night, after all, Dad almost killed him with the car. What's going on? Where have you been all week? </p\>
734
+ <p\>
735
+ But I can't go to the dance, I'll miss my favorite television program, Science Fiction Theater. Well uh, good, fine. Ahh. Ahh. Right, okay, so right around 9:00 she's gonna get very angry with me. That's right. </p\>
736
+ <p\>
737
+ I still don't understand, how am I supposed to go to the dance with her, if she's already going to the dance with you. Alright, okay Jennifer. What if I send in the tape and they don't like it. I mean, what if they say I'm no good. What if they say, 'Get out of here, kid, you got no future.' I mean, I just don't think I can take that kind of rejection. Jesus, I'm beginning to sound like my old man. Ahh. Alright, take it up, go. Doc. This is it. This is the answer. It says here that a bolt of lightning is gonna strike the clock tower precisely at 10:04 p.m. next Saturday night. If we could somehow harness this bolt of lightning, channel it into the flux capacitor, it just might work. Next Saturday night, we're sending you back to the future. </p\>
738
+ <p\>
739
+ Go. Yeah, it's in the back. The future, it's where you're going? Mother, with Marty's parents out of town, don't you think he oughta spend the night, after all, Dad almost killed him with the car. What's going on? Where have you been all week? </p\>
740
+ <p\>
741
+ But I can't go to the dance, I'll miss my favorite television program, Science Fiction Theater. Well uh, good, fine. Ahh. Ahh. Right, okay, so right around 9:00 she's gonna get very angry with me. That's right. </p\>
742
+ <p\>
743
+ I still don't understand, how am I supposed to go to the dance with her, if she's already going to the dance with you. Alright, okay Jennifer. What if I send in the tape and they don't like it. I mean, what if they say I'm no good. What if they say, 'Get out of here, kid, you got no future.' I mean, I just don't think I can take that kind of rejection. Jesus, I'm beginning to sound like my old man. Ahh. Alright, take it up, go. Doc. This is it. This is the answer. It says here that a bolt of lightning is gonna strike the clock tower precisely at 10:04 p.m. next Saturday night. If we could somehow harness this bolt of lightning, channel it into the flux capacitor, it just might work. Next Saturday night, we're sending you back to the future. </p\>
744
+ </IressText\>
745
+ </React.Fragment\>
746
+ </IressModal\>
747
+ </\>
748
+ );
749
+ };
750
+
751
+ export const App \= () \=> (
752
+ <IressModalProvider\>
753
+ <Story />
754
+ </IressModalProvider\>
755
+ );
756
+ );
757
+ };
758
+
759
+ export const App \= () \=> (
760
+ <IressModalProvider\>
761
+ <Story />
762
+ </IressModalProvider\>
763
+ );
764
+
765
+ ```
766
+
767
+ #### Props
768
+
769
+ | Name | Description | Default | Control |
770
+ | --- | --- | --- | --- |
771
+ | children |
772
+ Text to be displayed inside the modal.
773
+
774
+ ReactNode
775
+
776
+
777
+
778
+ | \- | \- |
779
+ | closeText |
780
+
781
+ Screenreader text for close button.
782
+
783
+ string
784
+
785
+
786
+
787
+ | \- | Set string |
788
+ | container |
789
+
790
+ The container element to render the modal into. By default, the modal will render at the end of the document body.
791
+
792
+ FloatingUIContainer
793
+
794
+
795
+
796
+ | \- | Set object |
797
+ | defaultShow |
798
+
799
+ When set to `true` the modal will be visible by default. Use for uncontrolled modals.
800
+
801
+ boolean
802
+
803
+
804
+
805
+ |
806
+
807
+ false
808
+
809
+ | Set boolean |
810
+ | disableBackdropClick |
811
+
812
+ When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
813
+
814
+ boolean
815
+
816
+
817
+
818
+ | \- | Set boolean |
819
+ | fixedFooter |
820
+
821
+ When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
822
+
823
+ boolean
824
+
825
+
826
+
827
+ | \- | FalseTrue |
828
+ | footer |
829
+
830
+ Panel to place modal controls.
831
+
832
+ ReactNode
833
+
834
+
835
+
836
+ | \- | \- |
837
+ | heading |
838
+
839
+ Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
840
+
841
+ union
842
+
843
+
844
+
845
+ | \- | Set object |
846
+ | id |
847
+
848
+ Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
849
+
850
+ string
851
+
852
+
853
+
854
+ | \- | storybook-modal |
855
+ | noCloseButton |
856
+
857
+ When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
858
+
859
+ boolean
860
+
861
+
862
+
863
+ | \- | Set boolean |
864
+ | onEntered |
865
+
866
+ Emitted when the modal has opened.
867
+
868
+ () => void
869
+
870
+ | \- | \- |
871
+ | onExited |
872
+
873
+ Emitted when the modal has closed.
874
+
875
+ () => void
876
+
877
+ | \- | \- |
878
+ | onShowChange |
879
+
880
+ Emitted when the modal has opened or closed internally. Use for controlled modals.
881
+
882
+ (show: boolean) => void
883
+
884
+ | \- | \- |
885
+ | onStatus |
886
+
887
+ Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
888
+
889
+ (status: 'unmounted' | 'initial' | 'open' | 'close') => void
890
+
891
+ | \- | \- |
892
+ | show |
893
+
894
+ When set to `true` the modal will be visible. Use for controlled modals.
895
+
896
+ boolean
897
+
898
+
899
+
900
+ | \- | \- |
901
+ | static |
902
+
903
+ When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
904
+
905
+ boolean
906
+
907
+
908
+
909
+ | \- | Set boolean |
910
+
911
+ ### Size
912
+
913
+ The `size` prop can be set to `sm`, `md` or `lg`. It defaults to `md`.
914
+
915
+ Below is a guide on when to use which size.
916
+
917
+ [](./iframe.html?id=components-modal--size)
918
+
919
+ Small modal
920
+ -----------
921
+
922
+ Small modals communicate the outcome of an irreversible action. They should be concise and straightforward, containing a single action and, in some cases, a single input field.
923
+
924
+ View small modal example
925
+
926
+ Medium modal
927
+ ------------
928
+
929
+ Medium modals provide optional supporting information to help users understand the context of a word or screen. They may contain a single action and, in some cases, a larger input such as a textarea.
930
+
931
+ View medium modal example
932
+
933
+ Large modal
934
+ -----------
935
+
936
+ Large modals facilitate sub-flows within a primary flow, allowing users to focus on tasks that will impact the underlying screen once the modal is closed (e.g., adding an item to a table or bulk uploading items). They should be used sparingly and only when there is a direct relationship to the underlying screen, where the action wouldn't warrant a separate dedicated screen.
937
+
938
+ View large modal example
939
+
940
+ ```
941
+
942
+ const SmallModal \= () \=> {
943
+ const \[show, setShow\] \= useState(false);
944
+ return (
945
+ <\>
946
+ <IressCard
947
+ heading\="Small modal"
948
+ stretch
949
+ footer\={
950
+ <IressButton onClick\={() \=> setShow(true)}\>
951
+ View small modal example </IressButton\>
952
+ }
953
+ \>
954
+ <p\>
955
+ Small modals communicate the outcome of an irreversible action. They should be concise and straightforward, containing a single action and, in some cases, a single input field. </p\>
956
+ </IressCard\>
957
+ <IressModal
958
+ width\="overlay.sm"
959
+ heading\="Terms of service update"
960
+ footer\={
961
+ <IressButton mode\="primary" onClick\={() \=> setShow(false)}\>
962
+ Accept </IressButton\>
963
+ }
964
+ disableBackdropClick
965
+ show\={show}
966
+ onShowChange\={setShow}
967
+ \>
968
+ <p\>
969
+ A change in our <a href\="#"\>terms of service</a\> takes effect on July 1st, 2024. Please read and accept the terms. </p\>
970
+ <IressCheckbox\>I accept the terms of service</IressCheckbox\>
971
+ </IressModal\>
972
+ </\>
973
+ );
974
+ };
975
+ const MediumModal \= () \=> {
976
+ const \[show, setShow\] \= useState(false);
977
+ return (
978
+ <\>
979
+ <IressCard
980
+ stretch
981
+ heading\="Medium modal"
982
+ footer\={
983
+ <IressButton onClick\={() \=> setShow(true)}\>
984
+ View medium modal example </IressButton\>
985
+ }
986
+ \>
987
+ <p\>
988
+ Medium modals provide optional supporting information to help users understand the context of a word or screen. They may contain a single action and, in some cases, a larger input such as a textarea. </p\>
989
+ </IressCard\>
990
+ <IressModal
991
+ width\="overlay.md"
992
+ heading\="History of Iress"
993
+ footer\={<IressButton onClick\={() \=> setShow(false)}\>Close</IressButton\>}
994
+ fixedFooter
995
+ show\={show}
996
+ onShowChange\={setShow}
997
+ \>
998
+ <h3\>Founding and Early Years (1993 - 2000)</h3\>
999
+ <p\>
1000
+ Iress Limited (ASX: IRE) was founded in 1993 in Melbourne, Australia, as a provider of financial market data and trading software. Initially, the company focused on delivering technology solutions for stockbrokers and traders, providing real-time market data, order management, and trading execution tools. </p\>
1001
+ <h3\>Expansion and IPO (2001 - 2010)</h3\>
1002
+ <p\>
1003
+ In 2001, Iress went public, listing on the Australian Securities Exchange (ASX). This move provided the company with capital to expand its operations and invest in new technologies. During this period, Iress expanded its services beyond trading platforms to include financial planning software, portfolio management, and wealth management solutions. The company also started expanding internationally, entering markets such as the UK, Canada, New Zealand, and South Africa, through organic growth and acquisitions. </p\>
1004
+ <h3\>Global Growth and Acquisitions (2011 - 2020)</h3\>
1005
+ <p\>
1006
+ Between 2011 and 2020, Iress continued its global expansion through acquisitions and product diversification. Key acquisitions included: </p\>
1007
+ <ul\>
1008
+ <li\>
1009
+ Avelo (2013): Strengthened its presence in the UK financial services market. </li\>
1010
+ <li\>
1011
+ Pulse Software (2014): Added financial advice solutions to its portfolio. </li\>
1012
+ <li\>
1013
+ INET BFA (2016): Expanded its reach into South Africa’s financial market. </li\>
1014
+ <li\>
1015
+ OneVue (2020): Enhanced its superannuation and investment administration capabilities. </li\>
1016
+ </ul\>
1017
+ <p\>
1018
+ During this period, Iress also expanded into mortgage lending technology and digital financial services, adapting to the increasing demand for automation and efficiency in financial markets. </p\>
1019
+ <h3\>Recent Developments (2021 - Present)</h3\>
1020
+ <p\>
1021
+ In 2021, Iress announced a strategic review of its business, focusing on streamlining operations and improving profitability. The company also experienced leadership changes, including new CEO appointments to drive digital transformation.{' '}
1022
+ </p\>
1023
+ <p\>
1024
+ Iress has continued to innovate with cloud-based solutions, artificial intelligence (AI), and data analytics, catering to financial institutions, brokers, and wealth management firms globally. </p\>
1025
+ <IressExpander activator\="Was this helpful?"\>
1026
+ <IressStack gap\="sm"\>
1027
+ <IressInput rows\={2} placeholder\="Enter your feedback" />
1028
+ <IressButton\>Provide feedback</IressButton\>
1029
+ </IressStack\>
1030
+ </IressExpander\>
1031
+ </IressModal\>
1032
+ </\>
1033
+ );
1034
+ };
1035
+ interface LargeModalActionsProps {
1036
+ isStart: boolean;
1037
+ isFinal: boolean;
1038
+ onBack: () \=> void;
1039
+ onNext: () \=> void;
1040
+ onCancel: () \=> void;
1041
+ onFinish: () \=> void;
1042
+ }
1043
+ const LargeModalActions \= ({
1044
+ isStart,
1045
+ isFinal,
1046
+ onBack,
1047
+ onNext,
1048
+ onCancel,
1049
+ onFinish,
1050
+ }: LargeModalActionsProps) \=> (
1051
+ <IressInline gap\="sm" horizontalAlign\={isFinal ? 'center' : 'left'}\>
1052
+ {isFinal && (
1053
+ <IressButton mode\="primary" onClick\={onFinish}\>
1054
+ Finish </IressButton\>
1055
+ )}
1056
+ {!isFinal && (
1057
+ <IressButton mode\="primary" onClick\={onNext}\>
1058
+ Next </IressButton\>
1059
+ )}
1060
+ {!isStart && !isFinal && (
1061
+ <IressButton onClick\={onBack}\>Previous</IressButton\>
1062
+ )}
1063
+ {!isFinal && (
1064
+ <IressInline ml\="auto"\>
1065
+ <IressButton onClick\={onCancel} mode\="tertiary"\>
1066
+ Cancel </IressButton\>
1067
+ </IressInline\>
1068
+ )}
1069
+ </IressInline\>
1070
+ );
1071
+ const LargeModal \= () \=> {
1072
+ const \[show, setShow\] \= useState(false);
1073
+ const \[step, setStep\] \= useState(0);
1074
+ return (
1075
+ <\>
1076
+ <IressCard
1077
+ heading\="Large modal"
1078
+ stretch
1079
+ footer\={
1080
+ <IressButton onClick\={() \=> setShow(true)}\>
1081
+ View large modal example </IressButton\>
1082
+ }
1083
+ \>
1084
+ <p\>
1085
+ Large modals facilitate sub-flows within a primary flow, allowing users to focus on tasks that will impact the underlying screen once the modal is closed (e.g., adding an item to a table or bulk uploading items). They should be used sparingly and only when there is a direct relationship to the underlying screen, where the action wouldn't warrant a separate dedicated screen. </p\>
1086
+ </IressCard\>
1087
+ <IressModal
1088
+ width\="overlay.lg"
1089
+ heading\="Upload from CSV"
1090
+ footer\={
1091
+ <LargeModalActions
1092
+ isStart\={step \=== 0}
1093
+ isFinal\={step \=== 2}
1094
+ onBack\={() \=> setStep(step \- 1)}
1095
+ onNext\={() \=> setStep(step + 1)}
1096
+ onFinish\={() \=> setShow(false)}
1097
+ onCancel\={() \=> setShow(false)}
1098
+ />
1099
+ }
1100
+ disableBackdropClick
1101
+ show\={show}
1102
+ onShowChange\={setShow}
1103
+ fixedFooter
1104
+ \>
1105
+ <IressStack gap\="lg" mb\="md"\>
1106
+ <IressProgress max\={3} value\={step + 1} />
1107
+ {step \=== 0 && (
1108
+ <IressStack gap\="md"\>
1109
+ <IressField label\="Select a file to upload"\>
1110
+ <IressInput type\="file" accept\=".csv" />
1111
+ </IressField\>
1112
+ <IressDivider />
1113
+ <IressField label\="Type of data"\>
1114
+ <IressRichSelect
1115
+ options\={\[
1116
+ { label: 'Clients' },
1117
+ { label: 'Products' },
1118
+ { label: 'Transactions' },
1119
+ \]}
1120
+ />
1121
+ </IressField\>
1122
+ <IressCheckbox\>Overwrite existing data</IressCheckbox\>
1123
+ </IressStack\>
1124
+ )}
1125
+ {step \=== 1 && (
1126
+ <IressTable
1127
+ caption\="Preview of data to be uploaded"
1128
+ columns\={\[
1129
+ { key: 'import', label: 'Upload', width: '1%' },
1130
+ { key: 'name', label: 'Name' },
1131
+ { key: 'email', label: 'Email' },
1132
+ \]}
1133
+ rows\={\[
1134
+ {
1135
+ import: <IressCheckbox defaultChecked />,
1136
+ name: 'Luke Skywalker',
1137
+ email: 'luke.skywalker@iress.com',
1138
+ },
1139
+ {
1140
+ import: <IressCheckbox defaultChecked />,
1141
+ name: 'Leia Skywalker',
1142
+ email: 'leia.skywalker@iress.com',
1143
+ },
1144
+ {
1145
+ import: <IressCheckbox defaultChecked />,
1146
+ name: 'Han Solo',
1147
+ email: 'han.solo@iress.com',
1148
+ },
1149
+ \]}
1150
+ />
1151
+ )}
1152
+ {step \=== 2 && (
1153
+ <IressStack gap\="md" horizontalAlign\="center"\>
1154
+ <img
1155
+ src\={modalIsDone}
1156
+ alt\=""
1157
+ style\={{ maxWidth: '200px', height: 'auto' }}
1158
+ />
1159
+ <h3\>3 items have been uploaded</h3\>
1160
+ <IressCheckbox\>Send a copy to yourself</IressCheckbox\>
1161
+ </IressStack\>
1162
+ )}
1163
+ </IressStack\>
1164
+ </IressModal\>
1165
+ </\>
1166
+ );
1167
+ };
1168
+ export const ModalSizes \= () \=> (
1169
+ <IressRow gutter\="spacing.700" verticalAlign\="stretch"\>
1170
+ <IressCol\>
1171
+ <SmallModal />
1172
+ </IressCol\>
1173
+ <IressCol\>
1174
+ <MediumModal />
1175
+ </IressCol\>
1176
+ <IressCol\>
1177
+ <LargeModal />
1178
+ </IressCol\>
1179
+ </IressRow\>
1180
+ );
1181
+
1182
+ ```
1183
+
1184
+ #### Props
1185
+
1186
+ | Name | Description | Default | Control |
1187
+ | --- | --- | --- | --- |
1188
+ | children |
1189
+ Text to be displayed inside the modal.
1190
+
1191
+ ReactNode
1192
+
1193
+
1194
+
1195
+ | \- | \- |
1196
+ | closeText |
1197
+
1198
+ Screenreader text for close button.
1199
+
1200
+ string
1201
+
1202
+
1203
+
1204
+ | \- | Set string |
1205
+ | container |
1206
+
1207
+ The container element to render the modal into. By default, the modal will render at the end of the document body.
1208
+
1209
+ FloatingUIContainer
1210
+
1211
+
1212
+
1213
+ | \- | Set object |
1214
+ | defaultShow |
1215
+
1216
+ When set to `true` the modal will be visible by default. Use for uncontrolled modals.
1217
+
1218
+ boolean
1219
+
1220
+
1221
+
1222
+ |
1223
+
1224
+ false
1225
+
1226
+ | Set boolean |
1227
+ | disableBackdropClick |
1228
+
1229
+ When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
1230
+
1231
+ boolean
1232
+
1233
+
1234
+
1235
+ | \- | Set boolean |
1236
+ | fixedFooter |
1237
+
1238
+ When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
1239
+
1240
+ boolean
1241
+
1242
+
1243
+
1244
+ | \- | Set boolean |
1245
+ | footer |
1246
+
1247
+ Panel to place modal controls.
1248
+
1249
+ ReactNode
1250
+
1251
+
1252
+
1253
+ | \- |
1254
+
1255
+ "Size modal footer"
1256
+
1257
+ |
1258
+ | heading |
1259
+
1260
+ Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
1261
+
1262
+ union
1263
+
1264
+
1265
+
1266
+ | \- | Set object |
1267
+ | id |
1268
+
1269
+ Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
1270
+
1271
+ string
1272
+
1273
+
1274
+
1275
+ | \- | \- |
1276
+ | noCloseButton |
1277
+
1278
+ When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
1279
+
1280
+ boolean
1281
+
1282
+
1283
+
1284
+ | \- | Set boolean |
1285
+ | onEntered |
1286
+
1287
+ Emitted when the modal has opened.
1288
+
1289
+ () => void
1290
+
1291
+ | \- | \- |
1292
+ | onExited |
1293
+
1294
+ Emitted when the modal has closed.
1295
+
1296
+ () => void
1297
+
1298
+ | \- | \- |
1299
+ | onShowChange |
1300
+
1301
+ Emitted when the modal has opened or closed internally. Use for controlled modals.
1302
+
1303
+ (show: boolean) => void
1304
+
1305
+ | \- | \- |
1306
+ | onStatus |
1307
+
1308
+ Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
1309
+
1310
+ (status: 'unmounted' | 'initial' | 'open' | 'close') => void
1311
+
1312
+ | \- | \- |
1313
+ | show |
1314
+
1315
+ When set to `true` the modal will be visible. Use for controlled modals.
1316
+
1317
+ boolean
1318
+
1319
+
1320
+
1321
+ | \- | \- |
1322
+ | size |
1323
+
1324
+ \-
1325
+
1326
+ | \- | \- |
1327
+ | static |
1328
+
1329
+ When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
1330
+
1331
+ boolean
1332
+
1333
+
1334
+
1335
+ | \- | Set boolean |
1336
+
1337
+ ### Responsive size
1338
+
1339
+ The `size` prop can take an object that takes five key/value pairs that correlate with the IDS breakpoints.
1340
+
1341
+ If you set a responsive `size`, the modal becomes full width on screens smaller than the value you specified. For example, if you want to create a large modal on medium screens and above:
1342
+
1343
+ <IressModal size\={{ md: IressModal.Size.Lg }}\>
1344
+
1345
+ ```
1346
+
1347
+ The modal will be full width on extra-small and small screens, and large width on medium, large and extra-large screens. This is the same as setting:
1348
+
1349
+ <IressModal size\={{ xs: IressModal.Size.Fullpage, md: IressModal.Size.Lg }}\>
1350
+
1351
+ ```
1352
+
1353
+ You can override this behaviour by specifying a value for `xs` in your size object:
1354
+
1355
+ <IressModal size\={{ xs: IressModal.Size.Sm, md: IressModal.Size.Lg }}\>
1356
+
1357
+ ```
1358
+
1359
+ [](./iframe.html?id=components-modal--responsive-size)
1360
+
1361
+ Responsive modal
1362
+
1363
+ ```
1364
+
1365
+ const Story \= () \=> {
1366
+ const { showModal } \= useModal();
1367
+ const MODAL\_ID \= 'storybook-modal';
1368
+ return (
1369
+ const Story \= () \=> {
1370
+ const { showModal } \= useModal();
1371
+ const MODAL\_ID \= 'storybook-modal';
1372
+ return (
1373
+ <\>
1374
+ <IressButton onClick\={() \=> showModal(MODAL\_ID)}\>
1375
+ Responsive modal </IressButton\>
1376
+ <IressModal
1377
+ footer\=""
1378
+ id\="storybook-modal"
1379
+ width\={{
1380
+ md: 'overlay.md',
1381
+ xs: 'overlay.sm',
1382
+ xxl: 'overlay.lg'
1383
+ }}
1384
+ \>
1385
+ <kn />
1386
+ </IressModal\>
1387
+ </\>
1388
+ );
1389
+ };
1390
+
1391
+ export const App \= () \=> (
1392
+ <IressModalProvider\>
1393
+ <Story />
1394
+ </IressModalProvider\>
1395
+ );
1396
+ );
1397
+ };
1398
+
1399
+ export const App \= () \=> (
1400
+ <IressModalProvider\>
1401
+ <Story />
1402
+ </IressModalProvider\>
1403
+ );
1404
+
1405
+ ```
1406
+
1407
+ #### Props
1408
+
1409
+ | Name | Description | Default | Control |
1410
+ | --- | --- | --- | --- |
1411
+ | children |
1412
+ Text to be displayed inside the modal.
1413
+
1414
+ ReactNode
1415
+
1416
+
1417
+
1418
+ | \- | \- |
1419
+ | closeText |
1420
+
1421
+ Screenreader text for close button.
1422
+
1423
+ string
1424
+
1425
+
1426
+
1427
+ | \- | Set string |
1428
+ | container |
1429
+
1430
+ The container element to render the modal into. By default, the modal will render at the end of the document body.
1431
+
1432
+ FloatingUIContainer
1433
+
1434
+
1435
+
1436
+ | \- | Set object |
1437
+ | defaultShow |
1438
+
1439
+ When set to `true` the modal will be visible by default. Use for uncontrolled modals.
1440
+
1441
+ boolean
1442
+
1443
+
1444
+
1445
+ |
1446
+
1447
+ false
1448
+
1449
+ | Set boolean |
1450
+ | disableBackdropClick |
1451
+
1452
+ When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
1453
+
1454
+ boolean
1455
+
1456
+
1457
+
1458
+ | \- | Set boolean |
1459
+ | fixedFooter |
1460
+
1461
+ When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
1462
+
1463
+ boolean
1464
+
1465
+
1466
+
1467
+ | \- | Set boolean |
1468
+ | footer |
1469
+
1470
+ Panel to place modal controls.
1471
+
1472
+ ReactNode
1473
+
1474
+
1475
+
1476
+ | \- |
1477
+
1478
+ ""
1479
+
1480
+ |
1481
+ | heading |
1482
+
1483
+ Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
1484
+
1485
+ union
1486
+
1487
+
1488
+
1489
+ | \- | Set object |
1490
+ | id |
1491
+
1492
+ Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
1493
+
1494
+ string
1495
+
1496
+
1497
+
1498
+ | \- | storybook-modal |
1499
+ | noCloseButton |
1500
+
1501
+ When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
1502
+
1503
+ boolean
1504
+
1505
+
1506
+
1507
+ | \- | Set boolean |
1508
+ | onEntered |
1509
+
1510
+ Emitted when the modal has opened.
1511
+
1512
+ () => void
1513
+
1514
+ | \- | \- |
1515
+ | onExited |
1516
+
1517
+ Emitted when the modal has closed.
1518
+
1519
+ () => void
1520
+
1521
+ | \- | \- |
1522
+ | onShowChange |
1523
+
1524
+ Emitted when the modal has opened or closed internally. Use for controlled modals.
1525
+
1526
+ (show: boolean) => void
1527
+
1528
+ | \- | \- |
1529
+ | onStatus |
1530
+
1531
+ Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
1532
+
1533
+ (status: 'unmounted' | 'initial' | 'open' | 'close') => void
1534
+
1535
+ | \- | \- |
1536
+ | show |
1537
+
1538
+ When set to `true` the modal will be visible. Use for controlled modals.
1539
+
1540
+ boolean
1541
+
1542
+
1543
+
1544
+ | \- | \- |
1545
+ | static |
1546
+
1547
+ When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
1548
+
1549
+ boolean
1550
+
1551
+
1552
+
1553
+ | \- | Set boolean |
1554
+ | width |
1555
+
1556
+ object
1557
+
1558
+
1559
+
1560
+ | \- |
1561
+
1562
+ RAW
1563
+
1564
+ width :
1565
+
1566
+ {
1567
+
1568
+ * xs : "overlay.sm"
1569
+ * md : "overlay.md"
1570
+ * xxl : "overlay.lg"
1571
+
1572
+ }
1573
+
1574
+
1575
+
1576
+
1577
+
1578
+
1579
+
1580
+ |
1581
+
1582
+ ### Disable closing
1583
+
1584
+ For instances where you require the user's full attention and you want to ensure they continue the current task before closing the modal, you can disable the backdrop and escape key using `disableBackdropClick` and/or hide the close button using `noCloseButton`.
1585
+
1586
+ **Note:** As these options remove the default handling of the closing the modal, please ensure you provide a clear way for the user to close the modal.
1587
+
1588
+ [](./iframe.html?id=components-modal--disable-closing)
1589
+
1590
+ Disable backdrop clickNo close button (please provide one, if you decide to hide the close button)Both (If you hide the close button, ensure you provide another way to close the modal)
1591
+
1592
+ ```
1593
+
1594
+ const Story \= () \=> {
1595
+ const { showModal } \= useModal();
1596
+ const MODAL\_ID \= 'storybook-modal';
1597
+ return (
1598
+ const Story \= () \=> {
1599
+ const { showModal } \= useModal();
1600
+ const MODAL\_ID \= 'storybook-modal';
1601
+ return (
1602
+ <IressStack gap\="md"\>
1603
+ <IressButton
1604
+ fluid
1605
+ onClick\={() \=> showModal("disable-backdrop-click")}
1606
+ \>
1607
+ Disable backdrop click </IressButton\>
1608
+ <IressModal
1609
+ disableBackdropClick
1610
+ footer\="Footer slot"
1611
+ id\="disable-backdrop-click"
1612
+ \>
1613
+ Modal content </IressModal\>
1614
+ <IressButton
1615
+ fluid
1616
+ onClick\={() \=> showModal("no-close-button")}
1617
+ \>
1618
+ No close button (please provide one, if you decide to hide the close button) </IressButton\>
1619
+ <IressModal
1620
+ footer\={<IressButton onClick\={() \=> showModal("no-close-button", false)}\>Close</IressButton\>}
1621
+ id\="no-close-button"
1622
+ noCloseButton
1623
+ \>
1624
+ Modal content </IressModal\>
1625
+ <IressButton
1626
+ fluid
1627
+ onClick\={() \=> showModal("both")}
1628
+ \>
1629
+ Both (If you hide the close button, ensure you provide another way to close the modal) </IressButton\>
1630
+ <IressModal
1631
+ disableBackdropClick
1632
+ footer\={<IressButton onClick\={() \=> showModal("both", false)}\>Close</IressButton\>}
1633
+ id\="both"
1634
+ noCloseButton
1635
+ \>
1636
+ Modal content </IressModal\>
1637
+ </IressStack\>
1638
+ );
1639
+ };
1640
+
1641
+ export const App \= () \=> (
1642
+ <IressModalProvider\>
1643
+ <Story />
1644
+ </IressModalProvider\>
1645
+ );
1646
+ );
1647
+ };
1648
+
1649
+ export const App \= () \=> (
1650
+ <IressModalProvider\>
1651
+ <Story />
1652
+ </IressModalProvider\>
1653
+ );
1654
+
1655
+ ```
1656
+
1657
+ #### Props
1658
+
1659
+ | Name | Description | Default | Control |
1660
+ | --- | --- | --- | --- |
1661
+ | children |
1662
+ Text to be displayed inside the modal.
1663
+
1664
+ ReactNode
1665
+
1666
+
1667
+
1668
+ | \- |
1669
+
1670
+ "Modal content"
1671
+
1672
+ |
1673
+ | closeText |
1674
+
1675
+ Screenreader text for close button.
1676
+
1677
+ string
1678
+
1679
+
1680
+
1681
+ | \- | Set string |
1682
+ | container |
1683
+
1684
+ The container element to render the modal into. By default, the modal will render at the end of the document body.
1685
+
1686
+ FloatingUIContainer
1687
+
1688
+
1689
+
1690
+ | \- | Set object |
1691
+ | defaultShow |
1692
+
1693
+ When set to `true` the modal will be visible by default. Use for uncontrolled modals.
1694
+
1695
+ boolean
1696
+
1697
+
1698
+
1699
+ |
1700
+
1701
+ false
1702
+
1703
+ | Set boolean |
1704
+ | disableBackdropClick |
1705
+
1706
+ When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
1707
+
1708
+ boolean
1709
+
1710
+
1711
+
1712
+ | \- | \- |
1713
+ | fixedFooter |
1714
+
1715
+ When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
1716
+
1717
+ boolean
1718
+
1719
+
1720
+
1721
+ | \- | Set boolean |
1722
+ | footer |
1723
+
1724
+ Panel to place modal controls.
1725
+
1726
+ ReactNode
1727
+
1728
+
1729
+
1730
+ | \- |
1731
+
1732
+ "Footer slot"
1733
+
1734
+ |
1735
+ | heading |
1736
+
1737
+ Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
1738
+
1739
+ union
1740
+
1741
+
1742
+
1743
+ | \- | Set object |
1744
+ | id |
1745
+
1746
+ Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
1747
+
1748
+ string
1749
+
1750
+
1751
+
1752
+ | \- | \- |
1753
+ | noCloseButton |
1754
+
1755
+ When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
1756
+
1757
+ boolean
1758
+
1759
+
1760
+
1761
+ | \- | \- |
1762
+ | onEntered |
1763
+
1764
+ Emitted when the modal has opened.
1765
+
1766
+ () => void
1767
+
1768
+ | \- | \- |
1769
+ | onExited |
1770
+
1771
+ Emitted when the modal has closed.
1772
+
1773
+ () => void
1774
+
1775
+ | \- | \- |
1776
+ | onShowChange |
1777
+
1778
+ Emitted when the modal has opened or closed internally. Use for controlled modals.
1779
+
1780
+ (show: boolean) => void
1781
+
1782
+ | \- | \- |
1783
+ | onStatus |
1784
+
1785
+ Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
1786
+
1787
+ (status: 'unmounted' | 'initial' | 'open' | 'close') => void
1788
+
1789
+ | \- | \- |
1790
+ | show |
1791
+
1792
+ When set to `true` the modal will be visible. Use for controlled modals.
1793
+
1794
+ boolean
1795
+
1796
+
1797
+
1798
+ | \- | \- |
1799
+ | static |
1800
+
1801
+ When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
1802
+
1803
+ boolean
1804
+
1805
+
1806
+
1807
+ | \- | Set boolean |
1808
+
1809
+ Migrating to version 5
1810
+ ----------------------
1811
+
1812
+ ### Adding the provider
1813
+
1814
+ For your components to work as previously, you will need to set up the `IressModalProvider` at the root of your application. This will allow you to use the `useModal` hook to open and close modals from anywhere in your application using the ID of the modal.
1815
+
1816
+ const App \= () \=> <IressModalProvider\>Rest of app here</IressModalProvider\>;
1817
+
1818
+ ```
1819
+
1820
+ ### Testing
1821
+
1822
+ In version 5, modals are rendered conditionally, meaning they will not be available in the DOM until they are shown. This means that you will need to update your tests to account for this, as you cannot interact with its contents until it is shown, unlike in version 4.
1823
+
1824
+ See below for an example in version 4 and version 5.
1825
+
1826
+ [](./iframe.html?id=components-modal--v-5-modal-diff)
1827
+
1828
+ Diff
1829
+
1830
+ Old
1831
+
1832
+ New
1833
+
1834
+ <table class="css-1n5o7vh-diff-container"><tbody><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text">import { render, waitFor, screen } from '@testing-library/react';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">import { render, screen, waitForElementToBeRemoved } from '@testing-library/react';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text">import { idsFireEvent, componentLoad } from '@iress/ids-react-test-utils';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">import { userEvent } from '@testing-library/user-event';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text">test('opening and closing a modal', async () =&gt; {</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> await componentLoad([</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> const trigger = screen.getByRole('button', { name: /open modal/i });</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> 'modal-trigger',</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> 'modal',</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> // activate modal</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> ]);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> await userEvent.click(trigger);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> const modal = await screen.findByRole('dialog');</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> const trigger = screen.getByTestId('modal-trigger');</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> const modal = screen.getByTestId('modal');</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> // In version 5, you can only interact with the modal once it has been loaded here.</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line"><pre></pre></td><td class="css-vl0irh-content css-10regm7-empty-line"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line"><pre></pre></td><td class="css-vl0irh-content css-10regm7-empty-line"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> // In version 4, you can already interact with the modal here as its in the DOM at this stage.</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> // activate modal</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> idsFireEvent.click(trigger);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> await waitFor(() =&gt; expect(modal).toBeVisible());</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> // close modal</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> const closeButton = screen.getByTestId('modal__close-button');</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> const closeButton = screen.getByRole('button', { name: /close/i });</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> idsFireEvent.click(closeButton);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> await userEvent.click(closeButton);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> await waitFor(() =&gt; expect(modal).not.toBeVisible());</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> await waitForElementToBeRemoved(modal);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text">});</pre></td></tr></tbody></table>
1835
+
1836
+ ```
1837
+
1838
+ {
1839
+ render: () \=> <DiffViewer allowModeChange oldValue\={\`import { render, waitFor, screen } from '@testing-library/react';
1840
+ import { idsFireEvent, componentLoad } from '@iress/ids-react-test-utils';
1841
+
1842
+ test('opening and closing a modal', async () => {
1843
+ await componentLoad(\[ 'modal-trigger', 'modal', \]);
1844
+ const trigger = screen.getByTestId('modal-trigger'); const modal = screen.getByTestId('modal');
1845
+ // In version 4, you can already interact with the modal here as its in the DOM at this stage.
1846
+ // activate modal idsFireEvent.click(trigger); await waitFor(() => expect(modal).toBeVisible());
1847
+ // close modal const closeButton = screen.getByTestId('modal\_\_close-button'); idsFireEvent.click(closeButton); await waitFor(() => expect(modal).not.toBeVisible());
1848
+ });\`} newValue\={\`import { render, screen, waitForElementToBeRemoved } from '@testing-library/react';
1849
+ import { userEvent } from '@testing-library/user-event';
1850
+ test('opening and closing a modal', async () => {
1851
+ const trigger = screen.getByRole('button', { name: /open modal/i });
1852
+ // activate modal await userEvent.click(trigger); const modal = await screen.findByRole('dialog');
1853
+ // In version 5, you can only interact with the modal once it has been loaded here.
1854
+ // close modal const closeButton = screen.getByRole('button', { name: /close/i }); await userEvent.click(closeButton); await waitForElementToBeRemoved(modal);
1855
+ });\`} />
1856
+ }
1857
+
1858
+ ```
1859
+
1860
+ #### Props
1861
+
1862
+ | Name | Description | Default | Control |
1863
+ | --- | --- | --- | --- |
1864
+ | children |
1865
+ Text to be displayed inside the modal.
1866
+
1867
+ ReactNode
1868
+
1869
+
1870
+
1871
+ | \- | \- |
1872
+ | closeText |
1873
+
1874
+ Screenreader text for close button.
1875
+
1876
+ string
1877
+
1878
+
1879
+
1880
+ | \- | \- |
1881
+ | container |
1882
+
1883
+ The container element to render the modal into. By default, the modal will render at the end of the document body.
1884
+
1885
+ FloatingUIContainer
1886
+
1887
+
1888
+
1889
+ | \- | \- |
1890
+ | defaultShow |
1891
+
1892
+ When set to `true` the modal will be visible by default. Use for uncontrolled modals.
1893
+
1894
+ boolean
1895
+
1896
+
1897
+
1898
+ |
1899
+
1900
+ false
1901
+
1902
+ | \- |
1903
+ | disableBackdropClick |
1904
+
1905
+ When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
1906
+
1907
+ boolean
1908
+
1909
+
1910
+
1911
+ | \- | \- |
1912
+ | fixedFooter |
1913
+
1914
+ When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
1915
+
1916
+ boolean
1917
+
1918
+
1919
+
1920
+ | \- | \- |
1921
+ | footer |
1922
+
1923
+ Panel to place modal controls.
1924
+
1925
+ ReactNode
1926
+
1927
+
1928
+
1929
+ | \- | \- |
1930
+ | heading |
1931
+
1932
+ Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
1933
+
1934
+ union
1935
+
1936
+
1937
+
1938
+ | \- | \- |
1939
+ | id |
1940
+
1941
+ Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
1942
+
1943
+ string
1944
+
1945
+
1946
+
1947
+ | \- | \- |
1948
+ | noCloseButton |
1949
+
1950
+ When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
1951
+
1952
+ boolean
1953
+
1954
+
1955
+
1956
+ | \- | \- |
1957
+ | onEntered |
1958
+
1959
+ Emitted when the modal has opened.
1960
+
1961
+ () => void
1962
+
1963
+ | \- | \- |
1964
+ | onExited |
1965
+
1966
+ Emitted when the modal has closed.
1967
+
1968
+ () => void
1969
+
1970
+ | \- | \- |
1971
+ | onShowChange |
1972
+
1973
+ Emitted when the modal has opened or closed internally. Use for controlled modals.
1974
+
1975
+ (show: boolean) => void
1976
+
1977
+ | \- | \- |
1978
+ | onStatus |
1979
+
1980
+ Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
1981
+
1982
+ (status: 'unmounted' | 'initial' | 'open' | 'close') => void
1983
+
1984
+ | \- | \- |
1985
+ | show |
1986
+
1987
+ When set to `true` the modal will be visible. Use for controlled modals.
1988
+
1989
+ boolean
1990
+
1991
+
1992
+
1993
+ | \- | \- |
1994
+ | static |
1995
+
1996
+ When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
1997
+
1998
+ boolean
1999
+
2000
+
2001
+
2002
+ | \- | \- |