@patternfly/react-docs 7.6.0-prerelease.6 → 7.6.0-prerelease.8
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.
- package/CHANGELOG.md +4 -0
- package/package.json +12 -13
- package/patternfly-docs/generated/components/about-modal/react.js +149 -0
- package/patternfly-docs/generated/components/accordion/react.js +262 -0
- package/patternfly-docs/generated/components/action-list/react.js +144 -0
- package/patternfly-docs/generated/components/alert/react-demos.js +56 -0
- package/patternfly-docs/generated/components/alert/react.js +1433 -0
- package/patternfly-docs/generated/components/avatar/react.js +166 -0
- package/patternfly-docs/generated/components/back-to-top/react-demos.js +60 -0
- package/patternfly-docs/generated/components/back-to-top/react.js +77 -0
- package/patternfly-docs/generated/components/backdrop/react.js +64 -0
- package/patternfly-docs/generated/components/background-image/react.js +62 -0
- package/patternfly-docs/generated/components/badge/react.js +97 -0
- package/patternfly-docs/generated/components/banner/react-demos.js +57 -0
- package/patternfly-docs/generated/components/banner/react.js +148 -0
- package/patternfly-docs/generated/components/brand/react.js +142 -0
- package/patternfly-docs/generated/components/breadcrumb/react.js +206 -0
- package/patternfly-docs/generated/components/button/react-demos.js +57 -0
- package/patternfly-docs/generated/components/button/react.js +826 -0
- package/patternfly-docs/generated/components/card/react-demos.js +201 -0
- package/patternfly-docs/generated/components/card/react.js +1015 -0
- package/patternfly-docs/generated/components/charts/area-chart/-Victory.js +1350 -0
- package/patternfly-docs/generated/components/charts/bar-chart/-Victory.js +1334 -0
- package/patternfly-docs/generated/components/charts/box-plot-chart/-Victory.js +1282 -0
- package/patternfly-docs/generated/components/charts/bullet-chart/-Victory.js +848 -0
- package/patternfly-docs/generated/components/charts/colors-for-charts/-Victory.js +192 -0
- package/patternfly-docs/generated/components/charts/donut-chart/-Victory.js +426 -0
- package/patternfly-docs/generated/components/charts/donut-utilization-chart/-Victory.js +804 -0
- package/patternfly-docs/generated/components/charts/legends/-Victory.js +3230 -0
- package/patternfly-docs/generated/components/charts/line-chart/-Victory.js +1178 -0
- package/patternfly-docs/generated/components/charts/line-chart/ECharts.js +525 -0
- package/patternfly-docs/generated/components/charts/patterns/-Victory.js +3382 -0
- package/patternfly-docs/generated/components/charts/pie-chart/-Victory.js +377 -0
- package/patternfly-docs/generated/components/charts/resize-observer/-Victory.js +2475 -0
- package/patternfly-docs/generated/components/charts/sankey-chart/ECharts.js +538 -0
- package/patternfly-docs/generated/components/charts/scatter-chart/-Victory.js +1551 -0
- package/patternfly-docs/generated/components/charts/skeletons/-Victory.js +4115 -0
- package/patternfly-docs/generated/components/charts/sparkline-chart/-Victory.js +955 -0
- package/patternfly-docs/generated/components/charts/stack-chart/-Victory.js +1173 -0
- package/patternfly-docs/generated/components/charts/threshold-chart/-Victory.js +1166 -0
- package/patternfly-docs/generated/components/charts/tooltips/-Victory.js +413 -0
- package/patternfly-docs/generated/components/chip/react-deprecated.js +323 -0
- package/patternfly-docs/generated/components/clipboard-copy/react.js +373 -0
- package/patternfly-docs/generated/components/code-block/react.js +148 -0
- package/patternfly-docs/generated/components/code-editor/react.js +659 -0
- package/patternfly-docs/generated/components/compass/react-demos.js +147 -0
- package/patternfly-docs/generated/components/compass/react.js +440 -0
- package/patternfly-docs/generated/components/content/react.js +248 -0
- package/patternfly-docs/generated/components/data-list/react-demos.js +90 -0
- package/patternfly-docs/generated/components/data-list/react.js +709 -0
- package/patternfly-docs/generated/components/date-and-time/calendar-month/react.js +283 -0
- package/patternfly-docs/generated/components/date-and-time/date-and-time-picker/react-demos.js +64 -0
- package/patternfly-docs/generated/components/date-and-time/date-picker/react-demos.js +83 -0
- package/patternfly-docs/generated/components/date-and-time/date-picker/react.js +395 -0
- package/patternfly-docs/generated/components/date-and-time/time-picker/react.js +241 -0
- package/patternfly-docs/generated/components/description-list/react-demos.js +58 -0
- package/patternfly-docs/generated/components/description-list/react.js +743 -0
- package/patternfly-docs/generated/components/divider/react.js +126 -0
- package/patternfly-docs/generated/components/drag-and-drop/react-demos.js +351 -0
- package/patternfly-docs/generated/components/drag-and-drop/react-deprecated.js +184 -0
- package/patternfly-docs/generated/components/drag-and-drop/react.js +137 -0
- package/patternfly-docs/generated/components/drawer/react.js +598 -0
- package/patternfly-docs/generated/components/dual-list-selector/react-deprecated.js +772 -0
- package/patternfly-docs/generated/components/dual-list-selector/react.js +594 -0
- package/patternfly-docs/generated/components/empty-state/react.js +199 -0
- package/patternfly-docs/generated/components/expandable-section/react-demos.js +65 -0
- package/patternfly-docs/generated/components/expandable-section/react.js +408 -0
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react-demos.js +52 -0
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react.js +398 -0
- package/patternfly-docs/generated/components/file-upload/simple-file-upload/react.js +749 -0
- package/patternfly-docs/generated/components/forms/checkbox/react.js +222 -0
- package/patternfly-docs/generated/components/forms/form/react.js +1106 -0
- package/patternfly-docs/generated/components/forms/form-select/react.js +208 -0
- package/patternfly-docs/generated/components/forms/radio/react.js +212 -0
- package/patternfly-docs/generated/components/forms/text-area/react.js +160 -0
- package/patternfly-docs/generated/components/forms/text-input/react.js +216 -0
- package/patternfly-docs/generated/components/helper-text/react-demos.js +180 -0
- package/patternfly-docs/generated/components/helper-text/react.js +164 -0
- package/patternfly-docs/generated/components/hero/react.js +88 -0
- package/patternfly-docs/generated/components/hint/react.js +169 -0
- package/patternfly-docs/generated/components/icon/react.js +215 -0
- package/patternfly-docs/generated/components/input-group/react.js +182 -0
- package/patternfly-docs/generated/components/jump-links/react-demos.js +154 -0
- package/patternfly-docs/generated/components/jump-links/react.js +212 -0
- package/patternfly-docs/generated/components/label/react-demos.js +57 -0
- package/patternfly-docs/generated/components/label/react.js +417 -0
- package/patternfly-docs/generated/components/list/react.js +175 -0
- package/patternfly-docs/generated/components/login-page/react.js +587 -0
- package/patternfly-docs/generated/components/masthead/react-demos.js +79 -0
- package/patternfly-docs/generated/components/masthead/react.js +291 -0
- package/patternfly-docs/generated/components/menus/application-launcher/react-demos.js +769 -0
- package/patternfly-docs/generated/components/menus/context-selector/react-demos.js +665 -0
- package/patternfly-docs/generated/components/menus/custom-menus/react-demos.js +187 -0
- package/patternfly-docs/generated/components/menus/dropdown/react-templates.js +163 -0
- package/patternfly-docs/generated/components/menus/dropdown/react.js +998 -0
- package/patternfly-docs/generated/components/menus/menu/react.js +1540 -0
- package/patternfly-docs/generated/components/menus/menu-toggle/react.js +747 -0
- package/patternfly-docs/generated/components/menus/options-menu/react-demos.js +508 -0
- package/patternfly-docs/generated/components/menus/select/react-templates.js +257 -0
- package/patternfly-docs/generated/components/menus/select/react.js +998 -0
- package/patternfly-docs/generated/components/modal/react-deprecated.js +554 -0
- package/patternfly-docs/generated/components/modal/react.js +597 -0
- package/patternfly-docs/generated/components/navigation/react-demos.js +356 -0
- package/patternfly-docs/generated/components/navigation/react.js +409 -0
- package/patternfly-docs/generated/components/notification-badge/react.js +196 -0
- package/patternfly-docs/generated/components/notification-drawer/react-demos.js +107 -0
- package/patternfly-docs/generated/components/notification-drawer/react.js +394 -0
- package/patternfly-docs/generated/components/number-input/react.js +210 -0
- package/patternfly-docs/generated/components/overflow-menu/react.js +274 -0
- package/patternfly-docs/generated/components/page/react-demos.js +149 -0
- package/patternfly-docs/generated/components/page/react.js +1352 -0
- package/patternfly-docs/generated/components/pagination/react.js +492 -0
- package/patternfly-docs/generated/components/panel/react.js +236 -0
- package/patternfly-docs/generated/components/popover/react.js +390 -0
- package/patternfly-docs/generated/components/progress/react-demos.js +59 -0
- package/patternfly-docs/generated/components/progress/react.js +283 -0
- package/patternfly-docs/generated/components/progress-stepper/react-demos.js +45 -0
- package/patternfly-docs/generated/components/progress-stepper/react.js +219 -0
- package/patternfly-docs/generated/components/search-input/react-demos.js +113 -0
- package/patternfly-docs/generated/components/search-input/react.js +263 -0
- package/patternfly-docs/generated/components/sidebar/react.js +236 -0
- package/patternfly-docs/generated/components/simple-list/react.js +200 -0
- package/patternfly-docs/generated/components/skeleton/react-demos.js +44 -0
- package/patternfly-docs/generated/components/skeleton/react.js +122 -0
- package/patternfly-docs/generated/components/skip-to-content/react.js +73 -0
- package/patternfly-docs/generated/components/slider/react.js +309 -0
- package/patternfly-docs/generated/components/spinner/react.js +111 -0
- package/patternfly-docs/generated/components/switch/react.js +163 -0
- package/patternfly-docs/generated/components/table/react-demos.js +355 -0
- package/patternfly-docs/generated/components/table/react-deprecated.js +1350 -0
- package/patternfly-docs/generated/components/table/react.js +3241 -0
- package/patternfly-docs/generated/components/tabs/react-demos.js +108 -0
- package/patternfly-docs/generated/components/tabs/react.js +1359 -0
- package/patternfly-docs/generated/components/text-input-group/react-demos.js +152 -0
- package/patternfly-docs/generated/components/text-input-group/react.js +278 -0
- package/patternfly-docs/generated/components/tile/react-deprecated.js +242 -0
- package/patternfly-docs/generated/components/timestamp/react.js +283 -0
- package/patternfly-docs/generated/components/title/react.js +94 -0
- package/patternfly-docs/generated/components/toggle-group/react.js +299 -0
- package/patternfly-docs/generated/components/toolbar/react-demos.js +66 -0
- package/patternfly-docs/generated/components/toolbar/react.js +932 -0
- package/patternfly-docs/generated/components/tooltip/react.js +241 -0
- package/patternfly-docs/generated/components/tree-view/react.js +429 -0
- package/patternfly-docs/generated/components/truncate/react.js +211 -0
- package/patternfly-docs/generated/components/wizard/react-demos.js +87 -0
- package/patternfly-docs/generated/components/wizard/react-deprecated.js +788 -0
- package/patternfly-docs/generated/components/wizard/react.js +986 -0
- package/patternfly-docs/generated/developer-guides/open-ui-automation/react.js +285 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/bullseye/react.js +70 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/flex/react.js +506 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/gallery/react.js +94 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/grid/react.js +272 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/level/react.js +87 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/split/react.js +124 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/stack/react.js +112 -0
- package/patternfly-docs/generated/index.js +1769 -0
- package/patternfly-docs/generated/patterns/card-view/react-demos.js +78 -0
- package/patternfly-docs/generated/patterns/filters/react-demos.js +141 -0
- package/patternfly-docs/generated/patterns/password-generator/react-demos.js +51 -0
- package/patternfly-docs/generated/patterns/password-strength/react-demos.js +61 -0
- package/patternfly-docs/generated/patterns/primary-detail/react-demos.js +124 -0
- package/patternfly-docs/generated/patterns/right-to-left/react-demos.js +81 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1,554 @@
|
|
|
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 { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';
|
|
5
|
+
import WarningTriangleIcon from '@patternfly/react-icons/dist/esm/icons/warning-triangle-icon';
|
|
6
|
+
import RhMicronsCaretDownIcon from '@patternfly/react-icons/dist/esm/icons/rh-microns-caret-down-icon';
|
|
7
|
+
import RhUiAttentionBellFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-attention-bell-fill-icon';
|
|
8
|
+
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
9
|
+
import spacing from '@patternfly/react-styles/css/utilities/Spacing/spacing';
|
|
10
|
+
import formStyles from '@patternfly/react-styles/css/components/Form/form';
|
|
11
|
+
const pageData = {
|
|
12
|
+
"id": "Modal",
|
|
13
|
+
"section": "components",
|
|
14
|
+
"subsection": "",
|
|
15
|
+
"deprecated": true,
|
|
16
|
+
"template": false,
|
|
17
|
+
"beta": false,
|
|
18
|
+
"demo": false,
|
|
19
|
+
"newImplementationLink": false,
|
|
20
|
+
"source": "react-deprecated",
|
|
21
|
+
"tabName": null,
|
|
22
|
+
"slug": "/components/modal/react-deprecated",
|
|
23
|
+
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/deprecated/components/Modal/examples/Modal.md",
|
|
24
|
+
"relPath": "packages/react-core/src/deprecated/components/Modal/examples/Modal.md",
|
|
25
|
+
"propComponents": [
|
|
26
|
+
{
|
|
27
|
+
"name": "Modal",
|
|
28
|
+
"description": "",
|
|
29
|
+
"props": [
|
|
30
|
+
{
|
|
31
|
+
"name": "actions",
|
|
32
|
+
"type": "any",
|
|
33
|
+
"description": "Action buttons to add to the standard modal footer. Ignored if the footer property\nis passed in.",
|
|
34
|
+
"defaultValue": "[]"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "appendTo",
|
|
38
|
+
"type": "HTMLElement | (() => HTMLElement)",
|
|
39
|
+
"description": "The parent container to append the modal to. Defaults to \"document.body\".",
|
|
40
|
+
"defaultValue": "() => document.body"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "aria-describedby",
|
|
44
|
+
"type": "string",
|
|
45
|
+
"description": "Id to use for the modal box descriptor.",
|
|
46
|
+
"defaultValue": "''"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "aria-label",
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "Accessible descriptor of the modal.",
|
|
52
|
+
"defaultValue": "''"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "aria-labelledby",
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "Id to use for the modal box label.",
|
|
58
|
+
"defaultValue": "''"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "bodyAriaLabel",
|
|
62
|
+
"type": "string",
|
|
63
|
+
"description": "Accessible label applied to the modal box body. This should be used to communicate\nimportant information about the modal box body div element if needed, such as that it\nis scrollable."
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "bodyAriaRole",
|
|
67
|
+
"type": "string",
|
|
68
|
+
"description": "Accessible role applied to the modal box body. This will default to \"region\" if the\nbodyAriaLabel property is passed in. Set to a more appropriate role as applicable\nbased on the modal content and context."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "children",
|
|
72
|
+
"type": "React.ReactNode",
|
|
73
|
+
"description": "Content rendered inside the modal.",
|
|
74
|
+
"required": true
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "className",
|
|
78
|
+
"type": "string",
|
|
79
|
+
"description": "Additional classes added to the modal.",
|
|
80
|
+
"defaultValue": "''"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "description",
|
|
84
|
+
"type": "React.ReactNode",
|
|
85
|
+
"description": "Description of the modal."
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "disableFocusTrap",
|
|
89
|
+
"type": "boolean",
|
|
90
|
+
"description": "Flag to disable focus trap."
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "elementToFocus",
|
|
94
|
+
"type": "HTMLElement | SVGElement | string",
|
|
95
|
+
"description": "The element to focus when the modal opens. By default the first\nfocusable element will receive focus."
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "footer",
|
|
99
|
+
"type": "React.ReactNode",
|
|
100
|
+
"description": "Custom footer."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "hasNoBodyWrapper",
|
|
104
|
+
"type": "boolean",
|
|
105
|
+
"description": "Flag indicating if modal content should be placed in a modal box body wrapper.",
|
|
106
|
+
"defaultValue": "false"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "header",
|
|
110
|
+
"type": "React.ReactNode",
|
|
111
|
+
"description": "Complex header (more than just text), supersedes the title property for header content."
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "help",
|
|
115
|
+
"type": "React.ReactNode",
|
|
116
|
+
"description": "Optional help section for the modal header."
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "id",
|
|
120
|
+
"type": "string",
|
|
121
|
+
"description": "An id to use for the modal box container.",
|
|
122
|
+
"defaultValue": "undefined"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"name": "isOpen",
|
|
126
|
+
"type": "boolean",
|
|
127
|
+
"description": "Flag to show the modal.",
|
|
128
|
+
"defaultValue": "false"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "maxWidth",
|
|
132
|
+
"type": "number | string",
|
|
133
|
+
"description": "Maximum width of the modal."
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "onClose",
|
|
137
|
+
"type": "(event: KeyboardEvent | React.MouseEvent) => void",
|
|
138
|
+
"description": "A callback for when the close button is clicked.",
|
|
139
|
+
"defaultValue": "() => undefined as any"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "onEscapePress",
|
|
143
|
+
"type": "(event: KeyboardEvent) => void",
|
|
144
|
+
"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."
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "ouiaId",
|
|
148
|
+
"type": "number | string",
|
|
149
|
+
"description": "Value to overwrite the randomly generated data-ouia-component-id."
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"name": "ouiaSafe",
|
|
153
|
+
"type": "boolean",
|
|
154
|
+
"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.",
|
|
155
|
+
"defaultValue": "true"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"name": "position",
|
|
159
|
+
"type": "'default' | 'top'",
|
|
160
|
+
"description": "Position of the modal. By default a modal will be positioned vertically and horizontally centered.",
|
|
161
|
+
"defaultValue": "'default'"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"name": "positionOffset",
|
|
165
|
+
"type": "string",
|
|
166
|
+
"description": "Offset from alternate position. Can be any valid CSS length/percentage."
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"name": "showClose",
|
|
170
|
+
"type": "boolean",
|
|
171
|
+
"description": "Flag to show the close button in the header area of the modal.",
|
|
172
|
+
"defaultValue": "true"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "title",
|
|
176
|
+
"type": "React.ReactNode",
|
|
177
|
+
"description": "Text content of the modal header.",
|
|
178
|
+
"defaultValue": "''"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"name": "titleIconVariant",
|
|
182
|
+
"type": "'success' | 'danger' | 'warning' | 'info' | 'custom' | React.ComponentType<any>",
|
|
183
|
+
"description": "Optional alert icon (or other) to show before the title of the modal header. When the\npredefined alert types are used the default styling will be automatically applied.",
|
|
184
|
+
"defaultValue": "null"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "titleLabel",
|
|
188
|
+
"type": "string",
|
|
189
|
+
"description": "Optional title label text for screen readers.",
|
|
190
|
+
"defaultValue": "''"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "variant",
|
|
194
|
+
"type": "'small' | 'medium' | 'large' | 'default'",
|
|
195
|
+
"description": "Variant of the modal.",
|
|
196
|
+
"defaultValue": "'default'"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "width",
|
|
200
|
+
"type": "number | string",
|
|
201
|
+
"description": "Default width of the modal."
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"cssPrefix": [
|
|
207
|
+
"pf-v6-c-modal-box"
|
|
208
|
+
],
|
|
209
|
+
"examples": [
|
|
210
|
+
"Basic modals",
|
|
211
|
+
"Scrollable modals",
|
|
212
|
+
"With a static description",
|
|
213
|
+
"Top aligned",
|
|
214
|
+
"Small modal",
|
|
215
|
+
"Medium modal",
|
|
216
|
+
"Large modal",
|
|
217
|
+
"Custom width",
|
|
218
|
+
"Custom header and footer",
|
|
219
|
+
"No header or footer",
|
|
220
|
+
"Title icon",
|
|
221
|
+
"Custom title icon",
|
|
222
|
+
"With wizard",
|
|
223
|
+
"With dropdown",
|
|
224
|
+
"With help",
|
|
225
|
+
"With form",
|
|
226
|
+
"Custom focus"
|
|
227
|
+
]
|
|
228
|
+
};
|
|
229
|
+
pageData.liveContext = {
|
|
230
|
+
Fragment,
|
|
231
|
+
useRef,
|
|
232
|
+
useState,
|
|
233
|
+
ModalDeprecated,
|
|
234
|
+
ModalVariantDeprecated,
|
|
235
|
+
WarningTriangleIcon,
|
|
236
|
+
RhMicronsCaretDownIcon,
|
|
237
|
+
RhUiAttentionBellFillIcon,
|
|
238
|
+
HelpIcon,
|
|
239
|
+
spacing,
|
|
240
|
+
formStyles
|
|
241
|
+
};
|
|
242
|
+
pageData.examples = {
|
|
243
|
+
'Basic modals': props =>
|
|
244
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated } from '@patternfly/react-core/deprecated';\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 <ModalDeprecated\n title=\"Basic modal\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n actions={[\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 ]}\n ouiaId=\"BasicModal\"\n >\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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"Basic modals","lang":"ts","className":""}}>
|
|
245
|
+
|
|
246
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
247
|
+
{`Basic modals give users the option to either confirm or cancel an action. To flag an open modal, use the `}
|
|
248
|
+
|
|
249
|
+
<code {...{"className":"ws-code "}}>
|
|
250
|
+
{`isOpen`}
|
|
251
|
+
</code>
|
|
252
|
+
{` property. To execute a callback when a modal is closed, use the `}
|
|
253
|
+
|
|
254
|
+
<code {...{"className":"ws-code "}}>
|
|
255
|
+
{`onClose`}
|
|
256
|
+
</code>
|
|
257
|
+
{` property.`}
|
|
258
|
+
</p>
|
|
259
|
+
</Example>,
|
|
260
|
+
'Scrollable modals': props =>
|
|
261
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';\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 <ModalDeprecated\n bodyAriaLabel=\"Scrollable modal content\"\n tabIndex={0}\n variant={ModalVariantDeprecated.small}\n title=\"Modal with overflowing content\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n actions={[\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 ]}\n >\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 tempus.\n Diam donec adipiscing tristique risus. Augue eget arcu dictum varius duis. Ut enim blandit volutpat maecenas\n volutpat blandit aliquam. Sit amet mauris commodo quis imperdiet massa tincidunt. Habitant morbi tristique\n senectus et netus. Fames ac turpis egestas sed tempus urna. Neque laoreet suspendisse interdum consectetur\n libero id. Volutpat lacus laoreet non curabitur gravida arcu ac tortor. Porta nibh venenatis cras sed felis eget\n velit. Nullam non nisi est sit amet facilisis. Nunc mi ipsum faucibus vitae. Lorem sed risus ultricies tristique\n nulla aliquet enim tortor at. Egestas sed tempus urna et pharetra pharetra massa massa ultricies. Lacinia quis\n vel eros donec ac odio tempor orci. Malesuada fames ac turpis egestas integer eget 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. Quis\n varius quam quisque id diam vel quam elementum. Viverra nam libero justo laoreet sit amet cursus. Sollicitudin\n tempor id eu nisl nunc. Orci nulla pellentesque dignissim enim sit amet venenatis. Dignissim enim sit amet\n venenatis urna cursus eget. Iaculis at erat pellentesque adipiscing commodo elit. Faucibus pulvinar elementum\n integer enim neque volutpat. Nullam vehicula ipsum a arcu cursus vitae congue mauris. Nunc mattis enim ut tellus\n elementum sagittis vitae. Blandit cursus risus at ultrices. Tellus mauris a diam maecenas sed enim. Non diam\n 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 morbi\n tempus iaculis urna. Enim ut tellus elementum sagittis vitae et leo duis ut. Lectus arcu bibendum at varius vel\n pharetra vel turpis. Morbi tristique senectus et netus et. Eget aliquet nibh praesent tristique magna sit amet\n purus gravida. Nisl purus in mollis nunc sed id semper risus. Id neque aliquam vestibulum morbi. Mauris a diam\n maecenas sed enim ut sem. Egestas tellus rutrum tellus pellentesque.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"Scrollable modals","lang":"ts","className":""}}>
|
|
262
|
+
|
|
263
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
264
|
+
{`To enable keyboard-accessible scrolling of a modal’s content, pass `}
|
|
265
|
+
|
|
266
|
+
<code {...{"className":"ws-code "}}>
|
|
267
|
+
{`tabIndex={0}`}
|
|
268
|
+
</code>
|
|
269
|
+
{` to the `}
|
|
270
|
+
|
|
271
|
+
<code {...{"className":"ws-code "}}>
|
|
272
|
+
{`<Modal>`}
|
|
273
|
+
</code>
|
|
274
|
+
{`.`}
|
|
275
|
+
</p>
|
|
276
|
+
</Example>,
|
|
277
|
+
'With a static description': props =>
|
|
278
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated } from '@patternfly/react-core/deprecated';\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 <ModalDeprecated\n title=\"Modal with description\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\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 actions={[\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 ]}\n >\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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"With a static description","lang":"ts","className":""}}>
|
|
279
|
+
|
|
280
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
281
|
+
{`To provide additional information about a modal, use the `}
|
|
282
|
+
|
|
283
|
+
<code {...{"className":"ws-code "}}>
|
|
284
|
+
{`description`}
|
|
285
|
+
</code>
|
|
286
|
+
{` property. Descriptions are static and do not scroll with other modal content.`}
|
|
287
|
+
</p>
|
|
288
|
+
</Example>,
|
|
289
|
+
'Top aligned': props =>
|
|
290
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated } from '@patternfly/react-core/deprecated';\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 <ModalDeprecated\n position=\"top\"\n title=\"Top aligned modal\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n actions={[\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 ]}\n >\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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"Top aligned","lang":"ts","className":""}}>
|
|
291
|
+
|
|
292
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
293
|
+
{`To override a modal's default center alignment, use the `}
|
|
294
|
+
|
|
295
|
+
<code {...{"className":"ws-code "}}>
|
|
296
|
+
{`position`}
|
|
297
|
+
</code>
|
|
298
|
+
{` property. In this example, `}
|
|
299
|
+
|
|
300
|
+
<code {...{"className":"ws-code "}}>
|
|
301
|
+
{`position`}
|
|
302
|
+
</code>
|
|
303
|
+
{` is set to "top", which moves the modal to the top of the screen.`}
|
|
304
|
+
</p>
|
|
305
|
+
</Example>,
|
|
306
|
+
'Small modal': props =>
|
|
307
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';\n\nexport const ModalSmall: 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 small modal\n </Button>\n <ModalDeprecated\n variant={ModalVariantDeprecated.small}\n title=\"Small modal\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n actions={[\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 ]}\n >\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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"Small modal","lang":"ts","className":""}}>
|
|
308
|
+
|
|
309
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
310
|
+
{`To adjust the size of a modal, use the `}
|
|
311
|
+
|
|
312
|
+
<code {...{"className":"ws-code "}}>
|
|
313
|
+
{`variant`}
|
|
314
|
+
</code>
|
|
315
|
+
{` property. Modal variants include "small", "medium", "large", and "default".`}
|
|
316
|
+
</p>
|
|
317
|
+
|
|
318
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
319
|
+
{`The following example displays a "small" modal by passing in `}
|
|
320
|
+
|
|
321
|
+
<code {...{"className":"ws-code "}}>
|
|
322
|
+
{`variant={ModalVariant.small}`}
|
|
323
|
+
</code>
|
|
324
|
+
{`.`}
|
|
325
|
+
</p>
|
|
326
|
+
</Example>,
|
|
327
|
+
'Medium modal': props =>
|
|
328
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';\n\nexport const ModalMedium: 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 medium modal\n </Button>\n <ModalDeprecated\n variant={ModalVariantDeprecated.medium}\n title=\"Medium modal\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n actions={[\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 ]}\n >\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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"Medium modal","lang":"ts","className":""}}>
|
|
329
|
+
|
|
330
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
331
|
+
{`The following example displays a "medium" modal by passing in `}
|
|
332
|
+
|
|
333
|
+
<code {...{"className":"ws-code "}}>
|
|
334
|
+
{`variant={ModalVariant.medium}`}
|
|
335
|
+
</code>
|
|
336
|
+
{`.`}
|
|
337
|
+
</p>
|
|
338
|
+
</Example>,
|
|
339
|
+
'Large modal': props =>
|
|
340
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';\n\nexport const ModalLarge: 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 large modal\n </Button>\n <ModalDeprecated\n variant={ModalVariantDeprecated.large}\n title=\"Large modal\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n actions={[\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 ]}\n >\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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"Large modal","lang":"ts","className":""}}>
|
|
341
|
+
|
|
342
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
343
|
+
{`The following example displays a "large" modal by passing in `}
|
|
344
|
+
|
|
345
|
+
<code {...{"className":"ws-code "}}>
|
|
346
|
+
{`variant={ModalVariant.large}`}
|
|
347
|
+
</code>
|
|
348
|
+
{`.`}
|
|
349
|
+
</p>
|
|
350
|
+
</Example>,
|
|
351
|
+
'Custom width': props =>
|
|
352
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated } from '@patternfly/react-core/deprecated';\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 <ModalDeprecated\n width=\"50%\"\n title=\"Custom width modal\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n actions={[\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 ]}\n >\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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"Custom width","lang":"ts","className":""}}>
|
|
353
|
+
|
|
354
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
355
|
+
{`To choose a specific width for a modal, use the `}
|
|
356
|
+
|
|
357
|
+
<code {...{"className":"ws-code "}}>
|
|
358
|
+
{`width`}
|
|
359
|
+
</code>
|
|
360
|
+
{` property. The following example has a `}
|
|
361
|
+
|
|
362
|
+
<code {...{"className":"ws-code "}}>
|
|
363
|
+
{`width`}
|
|
364
|
+
</code>
|
|
365
|
+
{` of "50%".`}
|
|
366
|
+
</p>
|
|
367
|
+
</Example>,
|
|
368
|
+
'Custom header and footer': props =>
|
|
369
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Title, TitleSizes } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';\nimport WarningTriangleIcon from '@patternfly/react-icons/dist/esm/icons/warning-triangle-icon';\nimport spacing from '@patternfly/react-styles/css/utilities/Spacing/spacing';\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 const header = (\n <Fragment>\n <Title id=\"modal-custom-header-label\" headingLevel=\"h1\" size={TitleSizes['2xl']}>\n Custom header/footer modal\n </Title>\n <p className={spacing.ptSm}>Allows for custom content in the header and/or footer by passing components.</p>\n </Fragment>\n );\n\n const footer = (\n <Title headingLevel=\"h4\" size={TitleSizes.md}>\n <WarningTriangleIcon />\n <span className={spacing.plSm}>Custom modal footer.</span>\n </Title>\n );\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show custom header/footer modal\n </Button>\n <ModalDeprecated\n variant={ModalVariantDeprecated.large}\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n header={header}\n aria-labelledby=\"modal-custom-header-label\"\n aria-describedby=\"modal-custom-header-description\"\n footer={footer}\n >\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 is\n 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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"Custom header and footer","lang":"ts","className":""}}>
|
|
370
|
+
|
|
371
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
372
|
+
{`To add a custom header and footer to a modal, set the `}
|
|
373
|
+
|
|
374
|
+
<code {...{"className":"ws-code "}}>
|
|
375
|
+
{`header`}
|
|
376
|
+
</code>
|
|
377
|
+
{` and `}
|
|
378
|
+
|
|
379
|
+
<code {...{"className":"ws-code "}}>
|
|
380
|
+
{`footer`}
|
|
381
|
+
</code>
|
|
382
|
+
{` properties to a custom implementation. The following example passes title components into both the header and the footer and also passes an icon to the footer.`}
|
|
383
|
+
</p>
|
|
384
|
+
</Example>,
|
|
385
|
+
'No header or footer': props =>
|
|
386
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';\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 <ModalDeprecated\n variant={ModalVariantDeprecated.large}\n isOpen={isModalOpen}\n aria-label=\"No header/footer modal\"\n aria-describedby=\"modal-no-header-description\"\n onClose={handleModalToggle}\n >\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 is\n 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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"No header or footer","lang":"ts","className":""}}>
|
|
387
|
+
|
|
388
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
389
|
+
{`To exclusively present information in a modal, remove the `}
|
|
390
|
+
|
|
391
|
+
<code {...{"className":"ws-code "}}>
|
|
392
|
+
{`header`}
|
|
393
|
+
</code>
|
|
394
|
+
{` and/or `}
|
|
395
|
+
|
|
396
|
+
<code {...{"className":"ws-code "}}>
|
|
397
|
+
{`footer`}
|
|
398
|
+
</code>
|
|
399
|
+
{`.`}
|
|
400
|
+
</p>
|
|
401
|
+
</Example>,
|
|
402
|
+
'Title icon': props =>
|
|
403
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated } from '@patternfly/react-core/deprecated';\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 <ModalDeprecated\n title=\"Title icon modal\"\n titleIconVariant=\"warning\"\n isOpen={isModalOpen}\n aria-describedby=\"modal-title-icon-description\"\n onClose={handleModalToggle}\n actions={[\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 ]}\n >\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 is\n 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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"Title icon","lang":"ts","className":""}}>
|
|
404
|
+
|
|
405
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
406
|
+
{`To add an icon before a modal’s title, use the `}
|
|
407
|
+
|
|
408
|
+
<code {...{"className":"ws-code "}}>
|
|
409
|
+
{`titleIconVariant`}
|
|
410
|
+
</code>
|
|
411
|
+
{`, which can be set to one of the predefined variants -- "success", "danger", "warning", "info", and "custom" -- or to an imported custom icon. The following example uses a "warning" variant.`}
|
|
412
|
+
</p>
|
|
413
|
+
</Example>,
|
|
414
|
+
'Custom title icon': props =>
|
|
415
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated } from '@patternfly/react-core/deprecated';\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 <ModalDeprecated\n title=\"Custom title icon modal\"\n titleIconVariant={RhUiAttentionBellFillIcon}\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n aria-describedby=\"modal-custom-icon-description\"\n actions={[\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 ]}\n >\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 is\n 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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"Custom title icon","lang":"ts","className":""}}>
|
|
416
|
+
|
|
417
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
418
|
+
{`To add a custom icon before a modal’s title, set `}
|
|
419
|
+
|
|
420
|
+
<code {...{"className":"ws-code "}}>
|
|
421
|
+
{`titleIconVariant`}
|
|
422
|
+
</code>
|
|
423
|
+
{` to an imported custom icon. The following example imports and uses an icon.`}
|
|
424
|
+
</p>
|
|
425
|
+
</Example>,
|
|
426
|
+
'With wizard': props =>
|
|
427
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Wizard, WizardHeader, WizardStep } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';\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 <ModalDeprecated\n variant={ModalVariantDeprecated.large}\n showClose={false}\n isOpen={isModalOpen}\n aria-labelledby=\"modal-wizard-label\"\n aria-describedby=\"modal-wizard-description\"\n onClose={handleModalToggle}\n hasNoBodyWrapper\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 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 </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"With wizard","lang":"ts","className":""}}>
|
|
428
|
+
|
|
429
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
430
|
+
{`To guide users through a series of steps in a modal, you can add a `}
|
|
431
|
+
|
|
432
|
+
<PatternflyThemeLink {...{"to":"/components/wizard","className":""}}>
|
|
433
|
+
{`wizard`}
|
|
434
|
+
</PatternflyThemeLink>
|
|
435
|
+
{` to a modal. To configure the `}
|
|
436
|
+
|
|
437
|
+
<code {...{"className":"ws-code "}}>
|
|
438
|
+
{`<Wizard>`}
|
|
439
|
+
</code>
|
|
440
|
+
{`, pass an array that contains a “name” and “component” value for each step into the `}
|
|
441
|
+
|
|
442
|
+
<code {...{"className":"ws-code "}}>
|
|
443
|
+
{`steps`}
|
|
444
|
+
</code>
|
|
445
|
+
{` property.`}
|
|
446
|
+
</p>
|
|
447
|
+
</Example>,
|
|
448
|
+
'With dropdown': props =>
|
|
449
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Dropdown, DropdownList, DropdownItem, MenuToggle, MenuToggleElement } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';\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 const element = document.getElementById('modal-dropdown-toggle');\n (element as HTMLElement).focus();\n };\n\n const onEscapePress = (event: KeyboardEvent) => {\n if (isDropdownOpen) {\n setIsDropdownOpen(!isDropdownOpen);\n onFocus();\n } else {\n handleModalToggle(event);\n }\n };\n\n return (\n <Fragment>\n <Button variant=\"primary\" onClick={handleModalToggle}>\n Show dropdown modal\n </Button>\n <ModalDeprecated\n title=\"Dropdown modal\"\n variant={ModalVariantDeprecated.small}\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n actions={[\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 ]}\n onEscapePress={onEscapePress}\n >\n <div>\n Set the dropdown <strong>menuAppendTo</strong> prop to <em>parent</em> in order to allow the dropdown menu\n break out of the modal container. You'll also want to handle closing of the modal yourself, by listening to\n the <strong>onEscapePress</strong> callback on the Modal component, so you can close the Dropdown first if\n it's open 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 ref={toggleRef} onClick={handleDropdownToggle} isExpanded={isDropdownOpen}>\n Dropdown\n </MenuToggle>\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 </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"With dropdown","lang":"ts","className":""}}>
|
|
450
|
+
|
|
451
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
452
|
+
{`To present a menu of actions or links to a user, you can add a `}
|
|
453
|
+
|
|
454
|
+
<PatternflyThemeLink {...{"to":"/components/menus/dropdown","className":""}}>
|
|
455
|
+
{`dropdown`}
|
|
456
|
+
</PatternflyThemeLink>
|
|
457
|
+
{` to a modal. To allow the dropdown to visually break out of the modal container, set the `}
|
|
458
|
+
|
|
459
|
+
<code {...{"className":"ws-code "}}>
|
|
460
|
+
{`menuAppendTo`}
|
|
461
|
+
</code>
|
|
462
|
+
{` property to “parent”. Handle the modal’s closing behavior by listening to the `}
|
|
463
|
+
|
|
464
|
+
<code {...{"className":"ws-code "}}>
|
|
465
|
+
{`onEscapePress`}
|
|
466
|
+
</code>
|
|
467
|
+
{` callback on the `}
|
|
468
|
+
|
|
469
|
+
<code {...{"className":"ws-code "}}>
|
|
470
|
+
{`<Modal>`}
|
|
471
|
+
</code>
|
|
472
|
+
{` component. This allows the "escape" key to collapse the dropdown without closing the entire modal.`}
|
|
473
|
+
</p>
|
|
474
|
+
</Example>,
|
|
475
|
+
'With help': props =>
|
|
476
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button, Popover } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated } from '@patternfly/react-core/deprecated';\n\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 <ModalDeprecated\n variant=\"small\"\n title=\"With help modal\"\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 turpis.\n </div>\n }\n footerContent=\"Popover Footer\"\n >\n <Button variant=\"plain\" aria-label=\"Help\" icon={<HelpIcon />} />\n </Popover>\n }\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n actions={[\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 ]}\n >\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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"With help","lang":"ts","className":""}}>
|
|
477
|
+
|
|
478
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
479
|
+
{`To help simplify and explain complex models, add a help `}
|
|
480
|
+
|
|
481
|
+
<PatternflyThemeLink {...{"to":"/components/popover","className":""}}>
|
|
482
|
+
{`popover`}
|
|
483
|
+
</PatternflyThemeLink>
|
|
484
|
+
{`. 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.`}
|
|
485
|
+
</p>
|
|
486
|
+
</Example>,
|
|
487
|
+
'With form': props =>
|
|
488
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useRef, useState } from 'react';\nimport { Button, Form, FormGroup, FormGroupLabelHelp, Popover, TextInput } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated, ModalVariant as ModalVariantDeprecated } from '@patternfly/react-core/deprecated';\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 <ModalDeprecated\n variant={ModalVariantDeprecated.small}\n title=\"Create account\"\n description=\"Enter your personal information below to create an account.\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n actions={[\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 ]}\n >\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 </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"With form","lang":"ts","className":""}}>
|
|
489
|
+
|
|
490
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
491
|
+
{`To collect user input within a modal, you can add a `}
|
|
492
|
+
|
|
493
|
+
<PatternflyThemeLink {...{"to":"/components/forms/form","className":""}}>
|
|
494
|
+
{`form`}
|
|
495
|
+
</PatternflyThemeLink>
|
|
496
|
+
{`.`}
|
|
497
|
+
</p>
|
|
498
|
+
|
|
499
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
500
|
+
{`To submit the form from a button in the modal's footer (outside of the `}
|
|
501
|
+
|
|
502
|
+
<code {...{"className":"ws-code "}}>
|
|
503
|
+
{`<Form>`}
|
|
504
|
+
</code>
|
|
505
|
+
{`), set the button's `}
|
|
506
|
+
|
|
507
|
+
<code {...{"className":"ws-code "}}>
|
|
508
|
+
{`form`}
|
|
509
|
+
</code>
|
|
510
|
+
{` property equal to the form's id.`}
|
|
511
|
+
</p>
|
|
512
|
+
</Example>,
|
|
513
|
+
'Custom focus': props =>
|
|
514
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Button } from '@patternfly/react-core';\nimport { Modal as ModalDeprecated } from '@patternfly/react-core/deprecated';\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 <ModalDeprecated\n elementToFocus=\"#modal-custom-focus-confirm-button\"\n title=\"Modal with custom focus\"\n isOpen={isModalOpen}\n onClose={handleModalToggle}\n actions={[\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 ]}\n >\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 est\n laborum.\n </ModalDeprecated>\n </Fragment>\n );\n};\n","title":"Custom focus","lang":"ts","className":""}}>
|
|
515
|
+
|
|
516
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
517
|
+
{`Use the `}
|
|
518
|
+
|
|
519
|
+
<code {...{"className":"ws-code "}}>
|
|
520
|
+
{`elementToFocus`}
|
|
521
|
+
</code>
|
|
522
|
+
{` property to customize which element inside the Modal receives focus when initially opened.`}
|
|
523
|
+
</p>
|
|
524
|
+
</Example>
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
const Component = () => (
|
|
528
|
+
<React.Fragment>
|
|
529
|
+
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
530
|
+
{`Examples`}
|
|
531
|
+
</AutoLinkHeader>
|
|
532
|
+
{React.createElement(pageData.examples["Basic modals"])}
|
|
533
|
+
{React.createElement(pageData.examples["Scrollable modals"])}
|
|
534
|
+
{React.createElement(pageData.examples["With a static description"])}
|
|
535
|
+
{React.createElement(pageData.examples["Top aligned"])}
|
|
536
|
+
{React.createElement(pageData.examples["Small modal"])}
|
|
537
|
+
{React.createElement(pageData.examples["Medium modal"])}
|
|
538
|
+
{React.createElement(pageData.examples["Large modal"])}
|
|
539
|
+
{React.createElement(pageData.examples["Custom width"])}
|
|
540
|
+
{React.createElement(pageData.examples["Custom header and footer"])}
|
|
541
|
+
{React.createElement(pageData.examples["No header or footer"])}
|
|
542
|
+
{React.createElement(pageData.examples["Title icon"])}
|
|
543
|
+
{React.createElement(pageData.examples["Custom title icon"])}
|
|
544
|
+
{React.createElement(pageData.examples["With wizard"])}
|
|
545
|
+
{React.createElement(pageData.examples["With dropdown"])}
|
|
546
|
+
{React.createElement(pageData.examples["With help"])}
|
|
547
|
+
{React.createElement(pageData.examples["With form"])}
|
|
548
|
+
{React.createElement(pageData.examples["Custom focus"])}
|
|
549
|
+
</React.Fragment>
|
|
550
|
+
);
|
|
551
|
+
Component.displayName = 'ComponentsModalReactDeprecatedDocs';
|
|
552
|
+
Component.pageData = pageData;
|
|
553
|
+
|
|
554
|
+
export default Component;
|