@patternfly/react-docs 7.6.0-prerelease.8 → 7.6.0-prerelease.9

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 (163) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE +21 -0
  3. package/package.json +12 -11
  4. package/patternfly-docs/generated/components/about-modal/react.js +0 -149
  5. package/patternfly-docs/generated/components/accordion/react.js +0 -262
  6. package/patternfly-docs/generated/components/action-list/react.js +0 -144
  7. package/patternfly-docs/generated/components/alert/react-demos.js +0 -56
  8. package/patternfly-docs/generated/components/alert/react.js +0 -1433
  9. package/patternfly-docs/generated/components/avatar/react.js +0 -166
  10. package/patternfly-docs/generated/components/back-to-top/react-demos.js +0 -60
  11. package/patternfly-docs/generated/components/back-to-top/react.js +0 -77
  12. package/patternfly-docs/generated/components/backdrop/react.js +0 -64
  13. package/patternfly-docs/generated/components/background-image/react.js +0 -62
  14. package/patternfly-docs/generated/components/badge/react.js +0 -97
  15. package/patternfly-docs/generated/components/banner/react-demos.js +0 -57
  16. package/patternfly-docs/generated/components/banner/react.js +0 -148
  17. package/patternfly-docs/generated/components/brand/react.js +0 -142
  18. package/patternfly-docs/generated/components/breadcrumb/react.js +0 -206
  19. package/patternfly-docs/generated/components/button/react-demos.js +0 -57
  20. package/patternfly-docs/generated/components/button/react.js +0 -826
  21. package/patternfly-docs/generated/components/card/react-demos.js +0 -201
  22. package/patternfly-docs/generated/components/card/react.js +0 -1015
  23. package/patternfly-docs/generated/components/charts/area-chart/-Victory.js +0 -1350
  24. package/patternfly-docs/generated/components/charts/bar-chart/-Victory.js +0 -1334
  25. package/patternfly-docs/generated/components/charts/box-plot-chart/-Victory.js +0 -1282
  26. package/patternfly-docs/generated/components/charts/bullet-chart/-Victory.js +0 -848
  27. package/patternfly-docs/generated/components/charts/colors-for-charts/-Victory.js +0 -192
  28. package/patternfly-docs/generated/components/charts/donut-chart/-Victory.js +0 -426
  29. package/patternfly-docs/generated/components/charts/donut-utilization-chart/-Victory.js +0 -804
  30. package/patternfly-docs/generated/components/charts/legends/-Victory.js +0 -3230
  31. package/patternfly-docs/generated/components/charts/line-chart/-Victory.js +0 -1178
  32. package/patternfly-docs/generated/components/charts/line-chart/ECharts.js +0 -525
  33. package/patternfly-docs/generated/components/charts/patterns/-Victory.js +0 -3382
  34. package/patternfly-docs/generated/components/charts/pie-chart/-Victory.js +0 -377
  35. package/patternfly-docs/generated/components/charts/resize-observer/-Victory.js +0 -2475
  36. package/patternfly-docs/generated/components/charts/sankey-chart/ECharts.js +0 -538
  37. package/patternfly-docs/generated/components/charts/scatter-chart/-Victory.js +0 -1551
  38. package/patternfly-docs/generated/components/charts/skeletons/-Victory.js +0 -4115
  39. package/patternfly-docs/generated/components/charts/sparkline-chart/-Victory.js +0 -955
  40. package/patternfly-docs/generated/components/charts/stack-chart/-Victory.js +0 -1173
  41. package/patternfly-docs/generated/components/charts/threshold-chart/-Victory.js +0 -1166
  42. package/patternfly-docs/generated/components/charts/tooltips/-Victory.js +0 -413
  43. package/patternfly-docs/generated/components/chip/react-deprecated.js +0 -323
  44. package/patternfly-docs/generated/components/clipboard-copy/react.js +0 -373
  45. package/patternfly-docs/generated/components/code-block/react.js +0 -148
  46. package/patternfly-docs/generated/components/code-editor/react.js +0 -659
  47. package/patternfly-docs/generated/components/compass/react-demos.js +0 -147
  48. package/patternfly-docs/generated/components/compass/react.js +0 -440
  49. package/patternfly-docs/generated/components/content/react.js +0 -248
  50. package/patternfly-docs/generated/components/data-list/react-demos.js +0 -90
  51. package/patternfly-docs/generated/components/data-list/react.js +0 -709
  52. package/patternfly-docs/generated/components/date-and-time/calendar-month/react.js +0 -283
  53. package/patternfly-docs/generated/components/date-and-time/date-and-time-picker/react-demos.js +0 -64
  54. package/patternfly-docs/generated/components/date-and-time/date-picker/react-demos.js +0 -83
  55. package/patternfly-docs/generated/components/date-and-time/date-picker/react.js +0 -395
  56. package/patternfly-docs/generated/components/date-and-time/time-picker/react.js +0 -241
  57. package/patternfly-docs/generated/components/description-list/react-demos.js +0 -58
  58. package/patternfly-docs/generated/components/description-list/react.js +0 -743
  59. package/patternfly-docs/generated/components/divider/react.js +0 -126
  60. package/patternfly-docs/generated/components/drag-and-drop/react-demos.js +0 -351
  61. package/patternfly-docs/generated/components/drag-and-drop/react-deprecated.js +0 -184
  62. package/patternfly-docs/generated/components/drag-and-drop/react.js +0 -137
  63. package/patternfly-docs/generated/components/drawer/react.js +0 -598
  64. package/patternfly-docs/generated/components/dual-list-selector/react-deprecated.js +0 -772
  65. package/patternfly-docs/generated/components/dual-list-selector/react.js +0 -594
  66. package/patternfly-docs/generated/components/empty-state/react.js +0 -199
  67. package/patternfly-docs/generated/components/expandable-section/react-demos.js +0 -65
  68. package/patternfly-docs/generated/components/expandable-section/react.js +0 -408
  69. package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react-demos.js +0 -52
  70. package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react.js +0 -398
  71. package/patternfly-docs/generated/components/file-upload/simple-file-upload/react.js +0 -749
  72. package/patternfly-docs/generated/components/forms/checkbox/react.js +0 -222
  73. package/patternfly-docs/generated/components/forms/form/react.js +0 -1106
  74. package/patternfly-docs/generated/components/forms/form-select/react.js +0 -208
  75. package/patternfly-docs/generated/components/forms/radio/react.js +0 -212
  76. package/patternfly-docs/generated/components/forms/text-area/react.js +0 -160
  77. package/patternfly-docs/generated/components/forms/text-input/react.js +0 -216
  78. package/patternfly-docs/generated/components/helper-text/react-demos.js +0 -180
  79. package/patternfly-docs/generated/components/helper-text/react.js +0 -164
  80. package/patternfly-docs/generated/components/hero/react.js +0 -88
  81. package/patternfly-docs/generated/components/hint/react.js +0 -169
  82. package/patternfly-docs/generated/components/icon/react.js +0 -215
  83. package/patternfly-docs/generated/components/input-group/react.js +0 -182
  84. package/patternfly-docs/generated/components/jump-links/react-demos.js +0 -154
  85. package/patternfly-docs/generated/components/jump-links/react.js +0 -212
  86. package/patternfly-docs/generated/components/label/react-demos.js +0 -57
  87. package/patternfly-docs/generated/components/label/react.js +0 -417
  88. package/patternfly-docs/generated/components/list/react.js +0 -175
  89. package/patternfly-docs/generated/components/login-page/react.js +0 -587
  90. package/patternfly-docs/generated/components/masthead/react-demos.js +0 -79
  91. package/patternfly-docs/generated/components/masthead/react.js +0 -291
  92. package/patternfly-docs/generated/components/menus/application-launcher/react-demos.js +0 -769
  93. package/patternfly-docs/generated/components/menus/context-selector/react-demos.js +0 -665
  94. package/patternfly-docs/generated/components/menus/custom-menus/react-demos.js +0 -187
  95. package/patternfly-docs/generated/components/menus/dropdown/react-templates.js +0 -163
  96. package/patternfly-docs/generated/components/menus/dropdown/react.js +0 -998
  97. package/patternfly-docs/generated/components/menus/menu/react.js +0 -1540
  98. package/patternfly-docs/generated/components/menus/menu-toggle/react.js +0 -747
  99. package/patternfly-docs/generated/components/menus/options-menu/react-demos.js +0 -508
  100. package/patternfly-docs/generated/components/menus/select/react-templates.js +0 -257
  101. package/patternfly-docs/generated/components/menus/select/react.js +0 -998
  102. package/patternfly-docs/generated/components/modal/react-deprecated.js +0 -554
  103. package/patternfly-docs/generated/components/modal/react.js +0 -597
  104. package/patternfly-docs/generated/components/navigation/react-demos.js +0 -356
  105. package/patternfly-docs/generated/components/navigation/react.js +0 -409
  106. package/patternfly-docs/generated/components/notification-badge/react.js +0 -196
  107. package/patternfly-docs/generated/components/notification-drawer/react-demos.js +0 -107
  108. package/patternfly-docs/generated/components/notification-drawer/react.js +0 -394
  109. package/patternfly-docs/generated/components/number-input/react.js +0 -210
  110. package/patternfly-docs/generated/components/overflow-menu/react.js +0 -274
  111. package/patternfly-docs/generated/components/page/react-demos.js +0 -149
  112. package/patternfly-docs/generated/components/page/react.js +0 -1352
  113. package/patternfly-docs/generated/components/pagination/react.js +0 -492
  114. package/patternfly-docs/generated/components/panel/react.js +0 -236
  115. package/patternfly-docs/generated/components/popover/react.js +0 -390
  116. package/patternfly-docs/generated/components/progress/react-demos.js +0 -59
  117. package/patternfly-docs/generated/components/progress/react.js +0 -283
  118. package/patternfly-docs/generated/components/progress-stepper/react-demos.js +0 -45
  119. package/patternfly-docs/generated/components/progress-stepper/react.js +0 -219
  120. package/patternfly-docs/generated/components/search-input/react-demos.js +0 -113
  121. package/patternfly-docs/generated/components/search-input/react.js +0 -263
  122. package/patternfly-docs/generated/components/sidebar/react.js +0 -236
  123. package/patternfly-docs/generated/components/simple-list/react.js +0 -200
  124. package/patternfly-docs/generated/components/skeleton/react-demos.js +0 -44
  125. package/patternfly-docs/generated/components/skeleton/react.js +0 -122
  126. package/patternfly-docs/generated/components/skip-to-content/react.js +0 -73
  127. package/patternfly-docs/generated/components/slider/react.js +0 -309
  128. package/patternfly-docs/generated/components/spinner/react.js +0 -111
  129. package/patternfly-docs/generated/components/switch/react.js +0 -163
  130. package/patternfly-docs/generated/components/table/react-demos.js +0 -355
  131. package/patternfly-docs/generated/components/table/react-deprecated.js +0 -1350
  132. package/patternfly-docs/generated/components/table/react.js +0 -3241
  133. package/patternfly-docs/generated/components/tabs/react-demos.js +0 -108
  134. package/patternfly-docs/generated/components/tabs/react.js +0 -1359
  135. package/patternfly-docs/generated/components/text-input-group/react-demos.js +0 -152
  136. package/patternfly-docs/generated/components/text-input-group/react.js +0 -278
  137. package/patternfly-docs/generated/components/tile/react-deprecated.js +0 -242
  138. package/patternfly-docs/generated/components/timestamp/react.js +0 -283
  139. package/patternfly-docs/generated/components/title/react.js +0 -94
  140. package/patternfly-docs/generated/components/toggle-group/react.js +0 -299
  141. package/patternfly-docs/generated/components/toolbar/react-demos.js +0 -66
  142. package/patternfly-docs/generated/components/toolbar/react.js +0 -932
  143. package/patternfly-docs/generated/components/tooltip/react.js +0 -241
  144. package/patternfly-docs/generated/components/tree-view/react.js +0 -429
  145. package/patternfly-docs/generated/components/truncate/react.js +0 -211
  146. package/patternfly-docs/generated/components/wizard/react-demos.js +0 -87
  147. package/patternfly-docs/generated/components/wizard/react-deprecated.js +0 -788
  148. package/patternfly-docs/generated/components/wizard/react.js +0 -986
  149. package/patternfly-docs/generated/developer-guides/open-ui-automation/react.js +0 -285
  150. package/patternfly-docs/generated/foundations-and-styles/layouts/bullseye/react.js +0 -70
  151. package/patternfly-docs/generated/foundations-and-styles/layouts/flex/react.js +0 -506
  152. package/patternfly-docs/generated/foundations-and-styles/layouts/gallery/react.js +0 -94
  153. package/patternfly-docs/generated/foundations-and-styles/layouts/grid/react.js +0 -272
  154. package/patternfly-docs/generated/foundations-and-styles/layouts/level/react.js +0 -87
  155. package/patternfly-docs/generated/foundations-and-styles/layouts/split/react.js +0 -124
  156. package/patternfly-docs/generated/foundations-and-styles/layouts/stack/react.js +0 -112
  157. package/patternfly-docs/generated/index.js +0 -1769
  158. package/patternfly-docs/generated/patterns/card-view/react-demos.js +0 -78
  159. package/patternfly-docs/generated/patterns/filters/react-demos.js +0 -141
  160. package/patternfly-docs/generated/patterns/password-generator/react-demos.js +0 -51
  161. package/patternfly-docs/generated/patterns/password-strength/react-demos.js +0 -61
  162. package/patternfly-docs/generated/patterns/primary-detail/react-demos.js +0 -124
  163. package/patternfly-docs/generated/patterns/right-to-left/react-demos.js +0 -81
@@ -1,597 +0,0 @@
1
- import React from 'react';
2
- import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
3
- import { Fragment, useRef, useState } from 'react';
4
- import WarningTriangleIcon from '@patternfly/react-icons/dist/esm/icons/warning-triangle-icon';
5
- import RhMicronsCaretDownIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-down-icon';
6
- import RhUiAttentionBellFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-attention-bell-fill-icon';
7
- import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
8
- import formStyles from '@patternfly/react-styles/css/components/Form/form';
9
- const pageData = {
10
- "id": "Modal",
11
- "section": "components",
12
- "subsection": "",
13
- "deprecated": false,
14
- "template": false,
15
- "beta": false,
16
- "demo": false,
17
- "newImplementationLink": false,
18
- "source": "react",
19
- "tabName": null,
20
- "slug": "/components/modal/react",
21
- "sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/Modal/examples/Modal.md",
22
- "relPath": "packages/react-core/src/components/Modal/examples/Modal.md",
23
- "propComponents": [
24
- {
25
- "name": "Modal",
26
- "description": "",
27
- "props": [
28
- {
29
- "name": "appendTo",
30
- "type": "HTMLElement | (() => HTMLElement)",
31
- "description": "The parent container to append the modal to. Defaults to \"document.body\".",
32
- "defaultValue": "() => document.body"
33
- },
34
- {
35
- "name": "aria-describedby",
36
- "type": "string",
37
- "description": "Id to use for the modal box description. This should match the ModalHeader labelId or descriptorId."
38
- },
39
- {
40
- "name": "aria-label",
41
- "type": "string",
42
- "description": "Adds an accessible name to the modal when there is no title in the ModalHeader."
43
- },
44
- {
45
- "name": "aria-labelledby",
46
- "type": "string",
47
- "description": "Id to use for the modal box label. This should include the ModalHeader labelId."
48
- },
49
- {
50
- "name": "backdropClassName",
51
- "type": "string",
52
- "description": "Additional classes added to the modal backdrop."
53
- },
54
- {
55
- "name": "children",
56
- "type": "React.ReactNode",
57
- "description": "Content rendered inside the modal.",
58
- "required": true
59
- },
60
- {
61
- "name": "className",
62
- "type": "string",
63
- "description": "Additional classes added to the modal."
64
- },
65
- {
66
- "name": "disableFocusTrap",
67
- "type": "boolean",
68
- "description": "Flag to disable focus trap."
69
- },
70
- {
71
- "name": "elementToFocus",
72
- "type": "HTMLElement | SVGElement | string",
73
- "description": "The element to focus when the modal opens. By default the first\nfocusable element will receive focus."
74
- },
75
- {
76
- "name": "focusTrapId",
77
- "type": "string",
78
- "description": "Id of the focus trap in the ModalContent component"
79
- },
80
- {
81
- "name": "id",
82
- "type": "string",
83
- "description": "An id to use for the modal box container."
84
- },
85
- {
86
- "name": "isOpen",
87
- "type": "boolean",
88
- "description": "Flag to show the modal.",
89
- "defaultValue": "false"
90
- },
91
- {
92
- "name": "maxWidth",
93
- "type": "number | string",
94
- "description": "Maximum width of the modal."
95
- },
96
- {
97
- "name": "onClose",
98
- "type": "(event: KeyboardEvent | React.MouseEvent) => void",
99
- "description": "Add callback for when the close button is clicked. This prop needs to be passed to render the close button"
100
- },
101
- {
102
- "name": "onEscapePress",
103
- "type": "(event: KeyboardEvent) => void",
104
- "description": "Modal handles pressing of the escape key and closes the modal. If you want to handle\nthis yourself you can use this callback function."
105
- },
106
- {
107
- "name": "ouiaId",
108
- "type": "number | string",
109
- "description": "Value to overwrite the randomly generated data-ouia-component-id."
110
- },
111
- {
112
- "name": "ouiaSafe",
113
- "type": "boolean",
114
- "description": "Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false.",
115
- "defaultValue": "true"
116
- },
117
- {
118
- "name": "position",
119
- "type": "'default' | 'top'",
120
- "description": "Position of the modal. By default a modal will be positioned vertically and horizontally centered.",
121
- "defaultValue": "'default'"
122
- },
123
- {
124
- "name": "positionOffset",
125
- "type": "string",
126
- "description": "Offset from alternate position. Can be any valid CSS length/percentage."
127
- },
128
- {
129
- "name": "variant",
130
- "type": "'small' | 'medium' | 'large' | 'default'",
131
- "description": "Variant of the modal.",
132
- "defaultValue": "'default'"
133
- },
134
- {
135
- "name": "width",
136
- "type": "number | string",
137
- "description": "Default width of the modal."
138
- }
139
- ]
140
- },
141
- {
142
- "name": "ModalBody",
143
- "description": "Renders content in the body of the modal",
144
- "props": [
145
- {
146
- "name": "aria-label",
147
- "type": "string",
148
- "description": "Accessible label applied to the modal body. This should be used to communicate\nimportant information about the modal body div element if needed, such as when it is scrollable."
149
- },
150
- {
151
- "name": "children",
152
- "type": "React.ReactNode",
153
- "description": "Content rendered inside the modal body."
154
- },
155
- {
156
- "name": "className",
157
- "type": "string",
158
- "description": "Additional classes added to the modal body."
159
- },
160
- {
161
- "name": "role",
162
- "type": "string",
163
- "description": "Accessible role applied to the modal body. This will default to \"region\" if the\naria-label property is passed in. Set to a more appropriate role as applicable\nbased on the modal content and context."
164
- }
165
- ]
166
- },
167
- {
168
- "name": "ModalHeader",
169
- "description": "Renders content in the header of the modal",
170
- "props": [
171
- {
172
- "name": "children",
173
- "type": "React.ReactNode",
174
- "description": "Custom content rendered inside the modal header. If children are supplied then the tile, tileIconVariant and titleScreenReaderText props are ignored."
175
- },
176
- {
177
- "name": "className",
178
- "type": "string",
179
- "description": "Additional classes added to the modal header."
180
- },
181
- {
182
- "name": "description",
183
- "type": "React.ReactNode",
184
- "description": "Description of the modal."
185
- },
186
- {
187
- "name": "descriptorId",
188
- "type": "string",
189
- "description": "Id of the modal description."
190
- },
191
- {
192
- "name": "help",
193
- "type": "React.ReactNode",
194
- "description": "Optional help section for the modal header."
195
- },
196
- {
197
- "name": "labelId",
198
- "type": "string",
199
- "description": "Id of the modal title."
200
- },
201
- {
202
- "name": "title",
203
- "type": "React.ReactNode",
204
- "description": "Content rendered inside the modal title."
205
- },
206
- {
207
- "name": "titleIconVariant",
208
- "type": "'success' | 'danger' | 'warning' | 'info' | 'custom' | React.ComponentType<any>",
209
- "description": "Optional alert icon (or other) to show before the title. When the predefined alert types\nare used the default styling will be automatically applied."
210
- },
211
- {
212
- "name": "titleScreenReaderText",
213
- "type": "string",
214
- "description": "Optional title label text for screen readers."
215
- }
216
- ]
217
- },
218
- {
219
- "name": "ModalFooter",
220
- "description": "Renders content in the footer of the modal",
221
- "props": [
222
- {
223
- "name": "children",
224
- "type": "React.ReactNode",
225
- "description": "Content rendered inside the modal footer."
226
- },
227
- {
228
- "name": "className",
229
- "type": "string",
230
- "description": "Additional classes added to the modal footer."
231
- }
232
- ]
233
- }
234
- ],
235
- "cssPrefix": [
236
- "pf-v6-c-modal-box"
237
- ],
238
- "examples": [
239
- "Basic modals",
240
- "Scrollable modals",
241
- "With a static description",
242
- "Top aligned",
243
- "Modal sizes",
244
- "Custom width",
245
- "Custom header",
246
- "No header or footer",
247
- "Title icon",
248
- "Custom title icon",
249
- "With wizard",
250
- "With dropdown",
251
- "With help",
252
- "With form",
253
- "Custom focus"
254
- ]
255
- };
256
- pageData.liveContext = {
257
- Fragment,
258
- useRef,
259
- useState,
260
- WarningTriangleIcon,
261
- RhMicronsCaretDownIcon,
262
- RhUiAttentionBellFillIcon,
263
- HelpIcon,
264
- formStyles
265
- };
266
- pageData.examples = {
267
- 'Basic modals': props =>
268
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalHeader } from '@patternfly/react-core';\n\nexport const ModalBasic: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle} ouiaId=\"ShowBasicModal\">\n Show basic modal\n </Button>\n <Modal\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n ouiaId=\"BasicModal\"\n aria-labelledby=\"basic-modal-title\"\n aria-describedby=\"modal-box-body-basic\"\n >\n <ModalHeader title=\"Basic modal\" labelId=\"basic-modal-title\" />\n <ModalBody id=\"modal-box-body-basic\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id\n est laborum.\n </ModalBody>\n <ModalFooter>\n <Button key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"Basic modals","lang":"ts","className":""}}>
269
-
270
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
271
- {`Basic modals give users the option to either confirm or cancel an action.`}
272
- </p>
273
-
274
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
275
- {`To flag an open modal, use the `}
276
-
277
- <code {...{"className":"ws-code "}}>
278
- {`isOpen`}
279
- </code>
280
- {` property. To execute a callback when a modal is closed, use the `}
281
-
282
- <code {...{"className":"ws-code "}}>
283
- {`onClose`}
284
- </code>
285
- {` property.`}
286
- </p>
287
-
288
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
289
- {`The `}
290
-
291
- <code {...{"className":"ws-code "}}>
292
- {`<ModalBody>`}
293
- </code>
294
- {`, `}
295
-
296
- <code {...{"className":"ws-code "}}>
297
- {`<ModalHeader>`}
298
- </code>
299
- {`, and `}
300
-
301
- <code {...{"className":"ws-code "}}>
302
- {`<ModalFooter>`}
303
- </code>
304
- {` components are not required, but are typically used to display the main content of the modal, modal title, and any button actions, respectively.`}
305
- </p>
306
- </Example>,
307
- 'Scrollable modals': props =>
308
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalHeader, ModalFooter, ModalVariant } from '@patternfly/react-core';\n\nexport const ModalWithOverflowingContent: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen((prevIsModalOpen) => !prevIsModalOpen);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show modal\n </Button>\n <Modal\n variant={ModalVariant.small}\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n aria-labelledby=\"scrollable-modal-title\"\n aria-describedby=\"modal-box-body-scrollable\"\n >\n <ModalHeader title=\"Modal with overflowing content\" labelId=\"scrollable-modal-title\" />\n <ModalBody tabIndex={0} id=\"modal-box-body-scrollable\" aria-label=\"Scrollable modal content\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Semper auctor neque vitae\n tempus. Diam donec adipiscing tristique risus. Augue eget arcu dictum varius duis. Ut enim blandit volutpat\n maecenas volutpat blandit aliquam. Sit amet mauris commodo quis imperdiet massa tincidunt. Habitant morbi\n tristique senectus et netus. Fames ac turpis egestas sed tempus urna. Neque laoreet suspendisse interdum\n consectetur libero id. Volutpat lacus laoreet non curabitur gravida arcu ac tortor. Porta nibh venenatis cras\n sed felis eget velit. Nullam non nisi est sit amet facilisis. Nunc mi ipsum faucibus vitae. Lorem sed risus\n ultricies tristique nulla aliquet enim tortor at. Egestas sed tempus urna et pharetra pharetra massa massa\n ultricies. Lacinia quis vel eros donec ac odio tempor orci. Malesuada fames ac turpis egestas integer eget\n aliquet.\n <br />\n <br />\n Neque aliquam vestibulum morbi blandit cursus risus at ultrices. Molestie at elementum eu facilisis sed odio\n morbi. Elit pellentesque habitant morbi tristique. Consequat nisl vel pretium lectus quam id leo in vitae.\n Quis varius quam quisque id diam vel quam elementum. Viverra nam libero justo laoreet sit amet cursus.\n Sollicitudin tempor id eu nisl nunc. Orci nulla pellentesque dignissim enim sit amet venenatis. Dignissim enim\n sit amet venenatis urna cursus eget. Iaculis at erat pellentesque adipiscing commodo elit. Faucibus pulvinar\n elementum integer enim neque volutpat. Nullam vehicula ipsum a arcu cursus vitae congue mauris. Nunc mattis\n enim ut tellus elementum sagittis vitae. Blandit cursus risus at ultrices. Tellus mauris a diam maecenas sed\n enim. Non diam phasellus vestibulum lorem sed risus ultricies tristique nulla.\n <br />\n <br />\n Nulla pharetra diam sit amet nisl suscipit adipiscing. Ac tortor vitae purus faucibus ornare suspendisse sed\n nisi. Sed felis eget velit aliquet sagittis id consectetur purus. Tincidunt tortor aliquam nulla facilisi cras\n fermentum. Volutpat est velit egestas dui id ornare arcu odio. Pharetra magna ac placerat vestibulum. Ultrices\n sagittis orci a scelerisque purus semper eget duis at. Nisi est sit amet facilisis magna etiam tempor orci eu.\n Convallis tellus id interdum velit. Facilisis sed odio morbi quis commodo odio aenean sed.\n <br />\n <br />\n Eu scelerisque felis imperdiet proin fermentum leo vel orci porta. Facilisi etiam dignissim diam quis enim\n lobortis scelerisque fermentum. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada. Magna\n etiam tempor orci eu lobortis elementum. Quis auctor elit sed vulputate mi sit. Eleifend quam adipiscing vitae\n proin sagittis nisl rhoncus mattis rhoncus. Erat velit scelerisque in dictum non. Sit amet nulla facilisi\n morbi tempus iaculis urna. Enim ut tellus elementum sagittis vitae et leo duis ut. Lectus arcu bibendum at\n varius vel pharetra vel turpis. Morbi tristique senectus et netus et. Eget aliquet nibh praesent tristique\n magna sit amet purus gravida. Nisl purus in mollis nunc sed id semper risus. Id neque aliquam vestibulum\n morbi. Mauris a diam maecenas sed enim ut sem. Egestas tellus rutrum tellus pellentesque.\n </ModalBody>\n <ModalFooter>\n <Button key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"Scrollable modals","lang":"ts","className":""}}>
309
-
310
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
311
- {`To enable keyboard-accessible scrolling of a modal’s content, pass `}
312
-
313
- <code {...{"className":"ws-code "}}>
314
- {`tabIndex={0}`}
315
- </code>
316
- {` to the `}
317
-
318
- <code {...{"className":"ws-code "}}>
319
- {`<ModalBody>`}
320
- </code>
321
- {`.`}
322
- </p>
323
- </Example>,
324
- 'With a static description': props =>
325
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalHeader, ModalFooter, ModalVariant } from '@patternfly/react-core';\n\nexport const ModalWithDescription: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show modal with description\n </Button>\n <Modal\n variant={ModalVariant.small}\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n aria-labelledby=\"modal-with-description-title\"\n aria-describedby=\"modal-box-body-with-description\"\n >\n <ModalHeader\n title=\"Modal with description\"\n labelId=\"modal-with-description-title\"\n 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.\"\n />\n\n <ModalBody tabIndex={0} id=\"modal-box-body-with-description\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Semper auctor neque vitae\n tempus. Diam donec adipiscing tristique risus. Augue eget arcu dictum varius duis. Ut enim blandit volutpat\n maecenas volutpat blandit aliquam. Sit amet mauris commodo quis imperdiet massa tincidunt. Habitant morbi\n tristique senectus et netus. Fames ac turpis egestas sed tempus urna. Neque laoreet suspendisse interdum\n consectetur libero id. Volutpat lacus laoreet non curabitur gravida arcu ac tortor. Porta nibh venenatis cras\n sed felis eget velit. Nullam non nisi est sit amet facilisis. Nunc mi ipsum faucibus vitae. Lorem sed risus\n ultricies tristique nulla aliquet enim tortor at. Egestas sed tempus urna et pharetra pharetra massa massa\n ultricies. Lacinia quis vel eros donec ac odio tempor orci. Malesuada fames ac turpis egestas integer eget\n aliquet.\n <br />\n <br />\n Neque aliquam vestibulum morbi blandit cursus risus at ultrices. Molestie at elementum eu facilisis sed odio\n morbi. Elit pellentesque habitant morbi tristique. Consequat nisl vel pretium lectus quam id leo in vitae.\n Quis varius quam quisque id diam vel quam elementum. Viverra nam libero justo laoreet sit amet cursus.\n Sollicitudin tempor id eu nisl nunc. Orci nulla pellentesque dignissim enim sit amet venenatis. Dignissim enim\n sit amet venenatis urna cursus eget. Iaculis at erat pellentesque adipiscing commodo elit. Faucibus pulvinar\n elementum integer enim neque volutpat. Nullam vehicula ipsum a arcu cursus vitae congue mauris. Nunc mattis\n enim ut tellus elementum sagittis vitae. Blandit cursus risus at ultrices. Tellus mauris a diam maecenas sed\n enim. Non diam phasellus vestibulum lorem sed risus ultricies tristique nulla.\n <br />\n <br />\n Nulla pharetra diam sit amet nisl suscipit adipiscing. Ac tortor vitae purus faucibus ornare suspendisse sed\n nisi. Sed felis eget velit aliquet sagittis id consectetur purus. Tincidunt tortor aliquam nulla facilisi cras\n fermentum. Volutpat est velit egestas dui id ornare arcu odio. Pharetra magna ac placerat vestibulum. Ultrices\n sagittis orci a scelerisque purus semper eget duis at. Nisi est sit amet facilisis magna etiam tempor orci eu.\n Convallis tellus id interdum velit. Facilisis sed odio morbi quis commodo odio aenean sed.\n <br />\n <br />\n Eu scelerisque felis imperdiet proin fermentum leo vel orci porta. Facilisi etiam dignissim diam quis enim\n lobortis scelerisque fermentum. Eleifend donec pretium vulputate sapien nec sagittis aliquam malesuada. Magna\n etiam tempor orci eu lobortis elementum. Quis auctor elit sed vulputate mi sit. Eleifend quam adipiscing vitae\n proin sagittis nisl rhoncus mattis rhoncus. Erat velit scelerisque in dictum non. Sit amet nulla facilisi\n morbi tempus iaculis urna. Enim ut tellus elementum sagittis vitae et leo duis ut. Lectus arcu bibendum at\n varius vel pharetra vel turpis. Morbi tristique senectus et netus et. Eget aliquet nibh praesent tristique\n magna sit amet purus gravida. Nisl purus in mollis nunc sed id semper risus. Id neque aliquam vestibulum\n morbi. Mauris a diam maecenas sed enim ut sem. Egestas tellus rutrum tellus pellentesque.\n </ModalBody>\n <ModalFooter>\n <Button key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"With a static description","lang":"ts","className":""}}>
326
-
327
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
328
- {`To provide additional information about a modal, use the `}
329
-
330
- <code {...{"className":"ws-code "}}>
331
- {`description`}
332
- </code>
333
- {` property. Descriptions are static and do not scroll with other modal content.`}
334
- </p>
335
- </Example>,
336
- 'Top aligned': props =>
337
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalHeader } from '@patternfly/react-core';\n\nexport const ModalTopAligned: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show top aligned modal\n </Button>\n <Modal\n position=\"top\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n aria-labelledby=\"top-aligned-modal-title\"\n aria-describedby=\"modal-box-body-top-aligned\"\n >\n <ModalHeader title=\"Top aligned modal\" labelId=\"top-aligned-modal-title\" />\n <ModalBody id=\"modal-box-body-top-aligned\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id\n est laborum.\n </ModalBody>\n <ModalFooter>\n <Button key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"Top aligned","lang":"ts","className":""}}>
338
-
339
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
340
- {`To override a modal's default center alignment, use the `}
341
-
342
- <code {...{"className":"ws-code "}}>
343
- {`position`}
344
- </code>
345
- {` property. In this example, `}
346
-
347
- <code {...{"className":"ws-code "}}>
348
- {`position`}
349
- </code>
350
- {` is set to "top", which moves the modal to the top of the screen.`}
351
- </p>
352
- </Example>,
353
- 'Modal sizes': props =>
354
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalHeader, ModalVariant, Radio } from '@patternfly/react-core';\n\nexport const ModalSize: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [selectedVariant, setSelectedVariant] = useState(ModalVariant.small);\n\n const capitalize = (input: string) => input[0].toUpperCase() + input.substring(1);\n const formatSizeVariantName = (variant: string) => capitalize(variant);\n\n const variantOptions = [ModalVariant.small, ModalVariant.medium, ModalVariant.large];\n\n const renderSizeOptions = variantOptions.map((variant) => (\n <Radio\n id={`modal-size-${variant}-selector`}\n label={`${formatSizeVariantName(variant)} variant`}\n isChecked={variant === selectedVariant}\n onChange={() => setSelectedVariant(variant)}\n key={formatSizeVariantName(variant)}\n name=\"Variant options\"\n />\n ));\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <Fragment>\n {renderSizeOptions}\n <br />\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show modal\n </Button>\n <Modal\n variant={selectedVariant}\n title=\"Variant modal\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n aria-labelledby=\"variant-modal-title\"\n aria-describedby=\"modal-box-body-variant\"\n >\n <ModalHeader title=\"Small modal\" labelId=\"variant-modal-title\" />\n <ModalBody id=\"modal-box-body-variant\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id\n est laborum.\n </ModalBody>\n <ModalFooter>\n <Button key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"Modal sizes","lang":"ts","className":""}}>
355
-
356
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
357
- {`To adjust the size of a modal, use the `}
358
-
359
- <code {...{"className":"ws-code "}}>
360
- {`variant`}
361
- </code>
362
- {` property. Modal variants include "small", "medium", "large", and "default".`}
363
- </p>
364
-
365
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
366
- {`In the following example, you can display each modal size option. To launch a modal with a specific size, first select the respective radio button, followed by the "Show modal" button.`}
367
- </p>
368
- </Example>,
369
- 'Custom width': props =>
370
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalHeader } from '@patternfly/react-core';\n\nexport const ModalCustomWidth: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show custom width modal\n </Button>\n <Modal\n width=\"50%\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n aria-labelledby=\"custom-width-modal-title\"\n aria-describedby=\"modal-box-body-custom-width\"\n >\n <ModalHeader title=\"Custom width modal\" labelId=\"custom-width-modal-title\" />\n <ModalBody id=\"modal-box-body-custom-width\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id\n est laborum.\n </ModalBody>\n <ModalFooter>\n <Button key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"Custom width","lang":"ts","className":""}}>
371
-
372
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
373
- {`To choose a specific width for a modal, use the `}
374
-
375
- <code {...{"className":"ws-code "}}>
376
- {`width`}
377
- </code>
378
- {` property. The following example has a `}
379
-
380
- <code {...{"className":"ws-code "}}>
381
- {`width`}
382
- </code>
383
- {` of "50%".`}
384
- </p>
385
- </Example>,
386
- 'Custom header': props =>
387
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport {\n Button,\n Modal,\n ModalBody,\n ModalFooter,\n ModalHeader,\n ModalVariant,\n Title,\n TitleSizes,\n Content,\n Flex\n} from '@patternfly/react-core';\n\nimport WarningTriangleIcon from '@patternfly/react-icons/dist/esm/icons/warning-triangle-icon';\n\nexport const ModalCustomHeaderFooter: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show custom header/footer modal\n </Button>\n <Modal\n variant={ModalVariant.large}\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n aria-labelledby=\"modal-custom-header-label\"\n aria-describedby=\"modal-custom-header-description\"\n >\n <ModalHeader>\n <Content>\n <h1 id=\"modal-custom-header-label\">Custom header modal</h1>\n <p>Add custom content to the header by not passing the titles prop the modal box header component.</p>\n </Content>\n </ModalHeader>\n <ModalBody>\n <span id=\"modal-custom-header-description\">\n When static text describing the modal is available outside of the modal header, it can be given an ID that\n is then passed in as the modal's aria-describedby value.\n </span>\n <br />\n <br />\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id\n est laborum.\n </ModalBody>\n <ModalFooter>\n <Title headingLevel=\"h4\" size={TitleSizes.md}>\n <Flex spaceItems={{ default: 'spaceItemsSm' }}>\n <WarningTriangleIcon />\n <span>Custom modal footer.</span>\n </Flex>\n </Title>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"Custom header","lang":"ts","className":""}}>
388
-
389
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
390
- {`To add a custom header to a modal, your custom content must be passed as a child of the `}
391
-
392
- <code {...{"className":"ws-code "}}>
393
- {`<ModalHeader>`}
394
- </code>
395
- {` component. Do not pass the `}
396
-
397
- <code {...{"className":"ws-code "}}>
398
- {`title`}
399
- </code>
400
- {` property to `}
401
-
402
- <code {...{"className":"ws-code "}}>
403
- {`<ModalHeader>`}
404
- </code>
405
- {` when using a custom header.`}
406
- </p>
407
- </Example>,
408
- 'No header or footer': props =>
409
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalVariant } from '@patternfly/react-core';\n\nexport const ModalNoHeaderFooter: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show no header/footer modal\n </Button>\n <Modal\n variant={ModalVariant.large}\n isOpen={isModalOpen}\n aria-label=\"No header/footer modal\"\n aria-describedby=\"modal-no-header-description\"\n onClose={handleModalToggle}\n >\n <ModalBody>\n <span id=\"modal-no-header-description\">\n When static text describing the modal is available outside of the modal header, it can be given an ID that\n is then passed in as the modal's aria-describedby value.\n </span>\n <br />\n <br />\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id\n est laborum.\n </ModalBody>\n </Modal>\n </Fragment>\n );\n};\n","title":"No header or footer","lang":"ts","className":""}}>
410
-
411
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
412
- {`To exclusively present information in a modal, remove the header and/or footer.`}
413
- </p>
414
-
415
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
416
- {`When a modal has no header or footer, make sure to add an `}
417
-
418
- <code {...{"className":"ws-code "}}>
419
- {`aria-label`}
420
- </code>
421
- {` explicitly stating this, so that those using assistive technologies can understand this context.`}
422
- </p>
423
- </Example>,
424
- 'Title icon': props =>
425
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalHeader } from '@patternfly/react-core';\n\nexport const ModalTitleIcon: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show title icon modal\n </Button>\n <Modal\n isOpen={isModalOpen}\n aria-describedby=\"modal-title-icon-description\"\n aria-labelledby=\"title-icon-modal-title\"\n onClose={handleModalToggle}\n >\n <ModalHeader title=\"Title icon modal\" titleIconVariant=\"warning\" labelId=\"title-icon-modal-title\" />\n <ModalBody>\n <span id=\"modal-title-icon-description\">\n When static text describing the modal is available outside of the modal header, it can be given an ID that\n is then passed in as the modal's aria-describedby value.\n </span>\n <br />\n <br />\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id\n est laborum.\n </ModalBody>\n <ModalFooter>\n <Button key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"Title icon","lang":"ts","className":""}}>
426
-
427
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
428
- {`To add an icon before a modal’s title, use the `}
429
-
430
- <code {...{"className":"ws-code "}}>
431
- {`titleIconVariant`}
432
- </code>
433
- {` property, which can be set to a "success", "danger", "warning", or "info" variant. The following example uses a "warning" variant.`}
434
- </p>
435
- </Example>,
436
- 'Custom title icon': props =>
437
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalHeader } from '@patternfly/react-core';\nimport RhUiAttentionBellFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-attention-bell-fill-icon';\n\nexport const ModalCustomTitleIcon: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show custom title icon modal\n </Button>\n <Modal\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n aria-describedby=\"modal-custom-icon-description\"\n aria-labelledby=\"custom-title-icon-modal-title\"\n >\n <ModalHeader\n title=\"Custom title icon modal\"\n titleIconVariant={RhUiAttentionBellFillIcon}\n labelId=\"custom-title-icon-modal-title\"\n />\n <ModalBody>\n <span id=\"modal-custom-icon-description\">\n When static text describing the modal is available outside of the modal header, it can be given an ID that\n is then passed in as the modal's aria-describedby value.\n </span>\n <br />\n <br />\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id\n est laborum.\n </ModalBody>\n <ModalFooter>\n <Button key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"Custom title icon","lang":"ts","className":""}}>
438
-
439
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
440
- {`To add a custom icon before a modal’s title, set `}
441
-
442
- <code {...{"className":"ws-code "}}>
443
- {`titleIconVariant`}
444
- </code>
445
- {` to an imported custom icon. The following example imports and uses an icon.`}
446
- </p>
447
- </Example>,
448
- 'With wizard': props =>
449
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalVariant, Wizard, WizardHeader, WizardStep } from '@patternfly/react-core';\n\nexport const ModalWithWizard: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen((prevIsModalOpen) => !prevIsModalOpen);\n };\n\n const handleWizardToggle = () => {\n setIsModalOpen((prevIsModalOpen) => !prevIsModalOpen);\n };\n\n const numberedSteps = [1, 2, 3, 4].map((stepNumber) => (\n <WizardStep name={`Step ${stepNumber}`} key={`Step ${stepNumber}`} id={`with-wizard-step-${stepNumber}`}>\n {`Step ${stepNumber}`}\n </WizardStep>\n ));\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show wizard modal\n </Button>\n <Modal\n variant={ModalVariant.large}\n isOpen={isModalOpen}\n aria-labelledby=\"modal-wizard-label\"\n aria-describedby=\"modal-wizard-description\"\n >\n <Wizard\n height={400}\n header={\n <WizardHeader\n title=\"Wizard modal\"\n titleId=\"modal-wizard-label\"\n description=\"This is a wizard inside of a modal.\"\n descriptionId=\"modal-wizard-description\"\n onClose={handleWizardToggle}\n closeButtonAriaLabel=\"Close wizard\"\n />\n }\n onClose={handleWizardToggle}\n >\n {numberedSteps}\n <WizardStep\n name=\"Review\"\n id=\"with-wizard-review-step\"\n footer={{ nextButtonText: 'Finish', onNext: handleWizardToggle }}\n >\n Review step\n </WizardStep>\n </Wizard>\n </Modal>\n </Fragment>\n );\n};\n","title":"With wizard","lang":"ts","className":""}}>
450
-
451
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
452
- {`To guide users through a series of steps in a modal, you can add a `}
453
-
454
- <PatternflyThemeLink {...{"to":"/components/wizard","className":""}}>
455
- {`wizard`}
456
- </PatternflyThemeLink>
457
- {` to a modal. To configure the `}
458
-
459
- <code {...{"className":"ws-code "}}>
460
- {`<Wizard>`}
461
- </code>
462
- {`, pass an array that contains a “name” and “component” value for each step into the `}
463
-
464
- <code {...{"className":"ws-code "}}>
465
- {`steps`}
466
- </code>
467
- {` property.`}
468
- </p>
469
- </Example>,
470
- 'With dropdown': props =>
471
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport {\n Button,\n Dropdown,\n DropdownList,\n DropdownItem,\n MenuToggle,\n MenuToggleElement,\n Modal,\n ModalBody,\n ModalHeader,\n ModalFooter,\n ModalVariant\n} from '@patternfly/react-core';\n\nexport const ModalWithDropdown: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [isDropdownOpen, setIsDropdownOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n setIsDropdownOpen(false);\n };\n\n const handleDropdownToggle = () => {\n setIsDropdownOpen(!isDropdownOpen);\n };\n\n const onSelect = () => {\n setIsDropdownOpen(!isDropdownOpen);\n onFocus();\n };\n\n const onFocus = () => {\n if (typeof document !== 'undefined') {\n const element = document.getElementById('modal-dropdown-toggle');\n (element as HTMLElement)?.focus();\n }\n };\n\n const onEscapePress = (event: KeyboardEvent) => {\n if (isDropdownOpen) {\n setIsDropdownOpen(!isDropdownOpen);\n onFocus();\n } else {\n handleModalToggle(event);\n }\n };\n\n const getAppendLocation = () => {\n // document doesn't exist when PatternFly website docs framework gets pre-rendered\n // this is just to avoid that issue - works fine at runtime without it\n if (typeof document !== 'undefined' && document.getElementById) {\n return document.getElementById('modal-with-dropdown-focus-trap');\n } else {\n return 'inline';\n }\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show dropdown modal\n </Button>\n <Modal\n variant={ModalVariant.small}\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n onEscapePress={onEscapePress}\n aria-labelledby=\"modal-with-dropdown\"\n aria-describedby=\"modal-box-body-with-dropdown\"\n focusTrapId=\"modal-with-dropdown-focus-trap\"\n >\n <ModalHeader title=\"Dropdown modal\" labelId=\"modal-with-dropdown\" />\n <ModalBody id=\"modal-box-body-with-dropdown\">\n <div>\n Using the Dropdown's default append location will interfere with keyboard accessibility due to the modal's\n built-in focus trap. To allow the dropdown to visually break out of the modal container, set the Dropdown's\n popperProps appendTo property to id of the focus trap for the modal. This can be done by adding prop\n focusTrapId to the modal, and then setting the append location to that as per this example. Otherwise you\n can use \"inline\" to allow it to scroll within the modal itself. Appending to the focus trap should allow the\n menu to expand visually outside the Modal (no scrollbar created in the Modal itself), and still allow\n focusing the content within that menu via keyboard. You should also handle the modal's closing behavior by\n listening to the\n <em>onEscapePress</em> callback on the Modal component. This allows the \"escape\" key to collapse the\n dropdown without closing the entire modal.\n </div>\n <br />\n <div>\n <Dropdown\n isOpen={isDropdownOpen}\n onSelect={onSelect}\n onOpenChange={(isOpen: boolean) => setIsDropdownOpen(isOpen)}\n toggle={(toggleRef: React.Ref<MenuToggleElement>) => (\n <MenuToggle\n id=\"modal-dropdown-toggle\"\n ref={toggleRef}\n onClick={handleDropdownToggle}\n isExpanded={isDropdownOpen}\n >\n Dropdown\n </MenuToggle>\n )}\n popperProps={{\n appendTo: getAppendLocation()\n }}\n >\n <DropdownList>\n <DropdownItem value={0} key=\"action\">\n Action\n </DropdownItem>\n <DropdownItem\n value={1}\n key=\"link\"\n to=\"#default-link2\"\n // Prevent the default onClick functionality for example purposes\n onClick={(ev: any) => ev.preventDefault()}\n >\n Link\n </DropdownItem>\n <DropdownItem value={2} isDisabled key=\"disabled action\">\n Disabled Action\n </DropdownItem>\n <DropdownItem value={3} isDisabled key=\"disabled link\" to=\"#default-link4\">\n Disabled Link\n </DropdownItem>\n </DropdownList>\n </Dropdown>\n </div>\n </ModalBody>\n <ModalFooter>\n <Button key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"With dropdown","lang":"ts","className":""}}>
472
-
473
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
474
- {`To present a menu of actions or links to a user, you can add a `}
475
-
476
- <PatternflyThemeLink {...{"to":"/components/menus/dropdown","className":""}}>
477
- {`dropdown`}
478
- </PatternflyThemeLink>
479
- {` to a modal.`}
480
- </p>
481
-
482
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
483
- {`Using the Dropdown's default append location will interfere with keyboard accessibility due to the modal's
484
- built-in focus trap. To allow the dropdown to visually break out of the modal container, set the Dropdown's
485
- `}
486
-
487
- <code {...{"className":"ws-code "}}>
488
- {`popperProps appendTo`}
489
- </code>
490
- {` property to id of the focus trap for the modal. This can be done by adding prop
491
- `}
492
-
493
- <code {...{"className":"ws-code "}}>
494
- {`focusTrapId`}
495
- </code>
496
- {` to the modal, and then setting the append location to that as per this example. Otherwise you
497
- can use `}
498
-
499
- <code {...{"className":"ws-code "}}>
500
- {`inline`}
501
- </code>
502
- {` to allow it to scroll within the modal itself. Appending to the focus trap should allow the
503
- menu to expand visually outside the Modal (no scrollbar created in the Modal itself), and still allow
504
- focusing the content within that menu via keyboard. You should also handle the modal's closing behavior by
505
- listening to the
506
- `}
507
-
508
- <code {...{"className":"ws-code "}}>
509
- {`onEscapePress`}
510
- </code>
511
- {` callback on the `}
512
-
513
- <code {...{"className":"ws-code "}}>
514
- {`<Modal>`}
515
- </code>
516
- {` component. This allows the "escape" key to collapse the
517
- dropdown without closing the entire modal.`}
518
- </p>
519
- </Example>,
520
- 'With help': props =>
521
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalHeader, Popover } from '@patternfly/react-core';\nimport HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';\n\nexport const ModalWithHelp: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show with help modal\n </Button>\n <Modal\n variant=\"small\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n aria-labelledby=\"with-help-modal-title\"\n aria-describedby=\"modal-box-body-with-help\"\n >\n <ModalHeader\n title=\"With help modal\"\n labelId=\"with-help-modal-title\"\n help={\n <Popover\n headerContent={<div>Help Popover</div>}\n bodyContent={\n <div>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla\n turpis.\n </div>\n }\n footerContent=\"Popover Footer\"\n >\n <Button variant=\"plain\" aria-label=\"Help\" icon={<HelpIcon />} />\n </Popover>\n }\n />\n <ModalBody id=\"modal-box-body-with-help\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id\n est laborum.\n </ModalBody>\n <ModalFooter>\n <Button key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"With help","lang":"ts","className":""}}>
522
-
523
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
524
- {`To help simplify and explain complex models, add a help `}
525
-
526
- <PatternflyThemeLink {...{"to":"/components/popover","className":""}}>
527
- {`popover`}
528
- </PatternflyThemeLink>
529
- {`. Only place a help icon at the modal level if its information applies to all content in the modal. If the help popover is specific to a particular modal section, place the help icon beside that section instead.`}
530
- </p>
531
- </Example>,
532
- 'With form': props =>
533
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useRef, useState } from 'react';\nimport {\n Button,\n Form,\n FormGroup,\n FormGroupLabelHelp,\n Modal,\n ModalBody,\n ModalFooter,\n ModalHeader,\n ModalVariant,\n Popover,\n TextInput\n} from '@patternfly/react-core';\n\nexport const ModalWithForm: React.FunctionComponent = () => {\n const [isModalOpen, setModalOpen] = useState(false);\n const [nameValue, setNameValue] = useState('');\n const [emailValue, setEmailValue] = useState('');\n const [addressValue, setAddressValue] = useState('');\n const nameLabelHelpRef = useRef(null);\n const emailLabelHelpRef = useRef(null);\n const addressLabelHelpRef = useRef(null);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setModalOpen(!isModalOpen);\n };\n\n const handleNameInputChange = (_event, value: string) => {\n setNameValue(value);\n };\n\n const handleEmailInputChange = (_event, value: string) => {\n setEmailValue(value);\n };\n const handleAddressInputChange = (_event, value: string) => {\n setAddressValue(value);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show modal with form\n </Button>\n <Modal\n variant={ModalVariant.small}\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n aria-labelledby=\"form-modal-title\"\n aria-describedby=\"modal-box-description-form\"\n >\n <ModalHeader\n title=\"Create account\"\n description=\"Enter your personal information below to create an account.\"\n descriptorId=\"modal-box-description-form\"\n labelId=\"form-modal-title\"\n />\n <ModalBody>\n <Form id=\"modal-with-form-form\">\n <FormGroup\n label=\"Name\"\n labelHelp={\n <Popover\n triggerRef={nameLabelHelpRef}\n headerContent={\n <div>\n The\n <a href=\"https://schema.org/name\" target=\"_blank\" rel=\"noopener noreferrer\">\n name\n </a>\n of a\n <a href=\"https://schema.org/Person\" target=\"_blank\" rel=\"noopener noreferrer\">\n Person\n </a>\n </div>\n }\n bodyContent={\n <div>\n Often composed of\n <a href=\"https://schema.org/givenName\" target=\"_blank\" rel=\"noopener noreferrer\">\n givenName\n </a>\n and\n <a href=\"https://schema.org/familyName\" target=\"_blank\" rel=\"noopener noreferrer\">\n familyName\n </a>\n .\n </div>\n }\n >\n <FormGroupLabelHelp ref={nameLabelHelpRef} aria-label=\"More info for name field\" />\n </Popover>\n }\n isRequired\n fieldId=\"modal-with-form-form-name\"\n >\n <TextInput\n isRequired\n type=\"email\"\n id=\"modal-with-form-form-name\"\n name=\"modal-with-form-form-name\"\n value={nameValue}\n onChange={handleNameInputChange}\n />\n </FormGroup>\n <FormGroup\n label=\"E-mail\"\n labelHelp={\n <Popover\n triggerRef={emailLabelHelpRef}\n headerContent={\n <div>\n The\n <a href=\"https://schema.org/email\" target=\"_blank\" rel=\"noopener noreferrer\">\n e-mail\n </a>\n of a\n <a href=\"https://schema.org/Person\" target=\"_blank\" rel=\"noopener noreferrer\">\n person\n </a>\n </div>\n }\n bodyContent={\n <div>\n Valid\n <a href=\"https://schema.org/email\" target=\"_blank\" rel=\"noopener noreferrer\">\n e-mail\n </a>\n address.\n </div>\n }\n >\n <FormGroupLabelHelp ref={emailLabelHelpRef} aria-label=\"More info for e-mail field\" />\n </Popover>\n }\n isRequired\n fieldId=\"modal-with-form-form-email\"\n >\n <TextInput\n isRequired\n type=\"email\"\n id=\"modal-with-form-form-email\"\n name=\"modal-with-form-form-email\"\n value={emailValue}\n onChange={handleEmailInputChange}\n />\n </FormGroup>\n <FormGroup\n label=\"Address\"\n labelHelp={\n <Popover\n triggerRef={addressLabelHelpRef}\n headerContent={\n <div>\n The\n <a href=\"https://schema.org/address\" target=\"_blank\" rel=\"noopener noreferrer\">\n address\n </a>\n of a\n <a href=\"https://schema.org/Person\" target=\"_blank\" rel=\"noopener noreferrer\">\n person\n </a>\n </div>\n }\n bodyContent={\n <div>\n Valid\n <a href=\"https://schema.org/PostalAddress\" target=\"_blank\" rel=\"noopener noreferrer\">\n postal address.\n </a>\n </div>\n }\n >\n <FormGroupLabelHelp ref={addressLabelHelpRef} aria-label=\"More info for address field\" />\n </Popover>\n }\n isRequired\n fieldId=\"modal-with-form-form-address\"\n >\n <TextInput\n isRequired\n type=\"email\"\n id=\"modal-with-form-form-address\"\n name=\"modal-with-form-form-address\"\n value={addressValue}\n onChange={handleAddressInputChange}\n />\n </FormGroup>\n </Form>\n </ModalBody>\n <ModalFooter>\n <Button key=\"create\" variant=\"primary\" form=\"modal-with-form-form\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </Modal>\n </Fragment>\n );\n};\n","title":"With form","lang":"ts","className":""}}>
534
-
535
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
536
- {`To collect user input within a modal, you can add a `}
537
-
538
- <PatternflyThemeLink {...{"to":"/components/forms/form","className":""}}>
539
- {`form`}
540
- </PatternflyThemeLink>
541
- {`.`}
542
- </p>
543
-
544
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
545
- {`To enable form submission from a button in the modal's footer (outside of the `}
546
-
547
- <code {...{"className":"ws-code "}}>
548
- {`<Form>`}
549
- </code>
550
- {`), set the button's `}
551
-
552
- <code {...{"className":"ws-code "}}>
553
- {`form`}
554
- </code>
555
- {` property equal to the form's id.`}
556
- </p>
557
- </Example>,
558
- 'Custom focus': props =>
559
- <Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Modal, ModalBody, ModalFooter, ModalHeader } from '@patternfly/react-core';\n\nexport const ModalCustomFocus: React.FunctionComponent = () => {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n const handleModalToggle = (_event: KeyboardEvent | React.MouseEvent) => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle} ouiaId=\"ShowBasicModal\">\n Show modal with custom focus\n </Button>\n <Modal\n elementToFocus=\"#modal-custom-focus-confirm-button\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n aria-labelledby=\"custom-focus-modal-title\"\n aria-describedby=\"modal-box-body-custom-focus\"\n >\n <ModalHeader title=\"Modal with custom focus\" labelId=\"custom-focus-modal-title\" />\n <ModalBody id=\"modal-box-body-custom-focus\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore\n magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\n pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id\n est laborum.\n <ModalFooter>\n <Button id=\"modal-custom-focus-confirm-button\" key=\"confirm\" variant=\"primary\" onClick={handleModalToggle}>\n Confirm\n </Button>\n <Button key=\"cancel\" variant=\"link\" onClick={handleModalToggle}>\n Cancel\n </Button>\n </ModalFooter>\n </ModalBody>\n </Modal>\n </Fragment>\n );\n};\n","title":"Custom focus","lang":"ts","className":""}}>
560
-
561
- <p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
562
- {`To customize which element inside the modal receives focus when initially opened, use the `}
563
-
564
- <code {...{"className":"ws-code "}}>
565
- {`elementToFocus`}
566
- </code>
567
- {` property\`.`}
568
- </p>
569
- </Example>
570
- };
571
-
572
- const Component = () => (
573
- <React.Fragment>
574
- <AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
575
- {`Examples`}
576
- </AutoLinkHeader>
577
- {React.createElement(pageData.examples["Basic modals"])}
578
- {React.createElement(pageData.examples["Scrollable modals"])}
579
- {React.createElement(pageData.examples["With a static description"])}
580
- {React.createElement(pageData.examples["Top aligned"])}
581
- {React.createElement(pageData.examples["Modal sizes"])}
582
- {React.createElement(pageData.examples["Custom width"])}
583
- {React.createElement(pageData.examples["Custom header"])}
584
- {React.createElement(pageData.examples["No header or footer"])}
585
- {React.createElement(pageData.examples["Title icon"])}
586
- {React.createElement(pageData.examples["Custom title icon"])}
587
- {React.createElement(pageData.examples["With wizard"])}
588
- {React.createElement(pageData.examples["With dropdown"])}
589
- {React.createElement(pageData.examples["With help"])}
590
- {React.createElement(pageData.examples["With form"])}
591
- {React.createElement(pageData.examples["Custom focus"])}
592
- </React.Fragment>
593
- );
594
- Component.displayName = 'ComponentsModalReactDocs';
595
- Component.pageData = pageData;
596
-
597
- export default Component;