@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,1106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
import { useRef, useEffect, useState } from 'react';
|
|
4
|
+
import RhUiErrorFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-error-fill-icon';
|
|
5
|
+
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
6
|
+
import TrashIcon from '@patternfly/react-icons/dist/esm/icons/trash-icon';
|
|
7
|
+
import styles from '@patternfly/react-styles/css/components/Form/form';
|
|
8
|
+
const pageData = {
|
|
9
|
+
"id": "Form",
|
|
10
|
+
"section": "components",
|
|
11
|
+
"subsection": "forms",
|
|
12
|
+
"deprecated": false,
|
|
13
|
+
"template": false,
|
|
14
|
+
"beta": false,
|
|
15
|
+
"demo": false,
|
|
16
|
+
"newImplementationLink": false,
|
|
17
|
+
"source": "react",
|
|
18
|
+
"tabName": null,
|
|
19
|
+
"slug": "/components/forms/form/react",
|
|
20
|
+
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/Form/examples/Form.md",
|
|
21
|
+
"relPath": "packages/react-core/src/components/Form/examples/Form.md",
|
|
22
|
+
"propComponents": [
|
|
23
|
+
{
|
|
24
|
+
"name": "ActionGroup",
|
|
25
|
+
"description": "",
|
|
26
|
+
"props": [
|
|
27
|
+
{
|
|
28
|
+
"name": "children",
|
|
29
|
+
"type": "React.ReactNode",
|
|
30
|
+
"description": "Anything that can be rendered as ActionGroup content.",
|
|
31
|
+
"defaultValue": "null"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "className",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "Additional classes added to the ActionGroup.",
|
|
37
|
+
"defaultValue": "''"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "Form",
|
|
43
|
+
"description": "",
|
|
44
|
+
"props": [
|
|
45
|
+
{
|
|
46
|
+
"name": "children",
|
|
47
|
+
"type": "React.ReactNode",
|
|
48
|
+
"description": "Anything that can be rendered as Form content."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "className",
|
|
52
|
+
"type": "string",
|
|
53
|
+
"description": "Additional classes added to the Form."
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "isHorizontal",
|
|
57
|
+
"type": "boolean",
|
|
58
|
+
"description": "Sets the Form to horizontal."
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "isWidthLimited",
|
|
62
|
+
"type": "boolean",
|
|
63
|
+
"description": "Limits the max-width of the form."
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "maxWidth",
|
|
67
|
+
"type": "string",
|
|
68
|
+
"description": "Sets a custom max-width for the form."
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "FormGroup",
|
|
74
|
+
"description": "",
|
|
75
|
+
"props": [
|
|
76
|
+
{
|
|
77
|
+
"name": "children",
|
|
78
|
+
"type": "React.ReactNode",
|
|
79
|
+
"description": "Anything that can be rendered as FormGroup content.",
|
|
80
|
+
"defaultValue": "null"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "className",
|
|
84
|
+
"type": "string",
|
|
85
|
+
"description": "Additional classes added to the FormGroup.",
|
|
86
|
+
"defaultValue": "''"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "fieldId",
|
|
90
|
+
"type": "string",
|
|
91
|
+
"description": "ID of an individual field or a group of multiple fields. Required when a role of \"group\" or \"radiogroup\" is passed in.\nIf only one field is included, its ID attribute and this prop must be the same."
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "hasNoPaddingTop",
|
|
95
|
+
"type": "boolean",
|
|
96
|
+
"description": "Removes top spacer from label.",
|
|
97
|
+
"defaultValue": "false"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "isInline",
|
|
101
|
+
"type": "boolean",
|
|
102
|
+
"description": "Sets the FormGroup isInline.",
|
|
103
|
+
"defaultValue": "false"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "isRequired",
|
|
107
|
+
"type": "boolean",
|
|
108
|
+
"description": "Sets the FormGroup required.",
|
|
109
|
+
"defaultValue": "false"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "isStack",
|
|
113
|
+
"type": "boolean",
|
|
114
|
+
"description": "Sets the FormGroupControl to be stacked",
|
|
115
|
+
"defaultValue": "false"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "label",
|
|
119
|
+
"type": "React.ReactNode",
|
|
120
|
+
"description": "Label text before the field."
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "labelHelp",
|
|
124
|
+
"type": "React.ReactElement<any>",
|
|
125
|
+
"description": "A help button for the label. We recommend using FormGroupLabelHelp element as a help icon button. The help button should be wrapped or linked to our popover component."
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "labelInfo",
|
|
129
|
+
"type": "React.ReactNode",
|
|
130
|
+
"description": "Additional label information displayed after the label."
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "role",
|
|
134
|
+
"type": "string",
|
|
135
|
+
"description": "Sets the role of the form group. Pass in \"radiogroup\" when the form group contains multiple\nradio inputs, or pass in \"group\" when the form group contains multiple of any other input type."
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "FormGroupLabelHelp",
|
|
141
|
+
"description": "A help button to be passed to the FormGroup's labelHelp property. This should be wrapped or linked\nto our Popover component.",
|
|
142
|
+
"props": [
|
|
143
|
+
{
|
|
144
|
+
"name": "aria-label",
|
|
145
|
+
"type": "string",
|
|
146
|
+
"description": "Adds accessible text to the button.",
|
|
147
|
+
"required": true
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "children",
|
|
151
|
+
"type": "React.ReactNode",
|
|
152
|
+
"description": "Content rendered inside the button"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "className",
|
|
156
|
+
"type": "string",
|
|
157
|
+
"description": "Additional classes added to the button"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "component",
|
|
161
|
+
"type": "React.ElementType<any> | React.ComponentType<any>",
|
|
162
|
+
"description": "Sets the base component to render. defaults to button"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "countOptions",
|
|
166
|
+
"type": "BadgeCountObject",
|
|
167
|
+
"description": "Adds count number to button"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "hamburgerVariant",
|
|
171
|
+
"type": "'expand' | 'collapse'",
|
|
172
|
+
"description": "Adjusts and animates the hamburger icon to indicate what will happen upon clicking the button."
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "hasNoPadding",
|
|
176
|
+
"type": "boolean",
|
|
177
|
+
"description": "Applies no padding on a plain button variant. Use when plain button is placed inline with text"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "icon",
|
|
181
|
+
"type": "React.ReactNode | null",
|
|
182
|
+
"description": "Icon for the button."
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "iconPosition",
|
|
186
|
+
"type": "'start' | 'end' | 'left' | 'right'",
|
|
187
|
+
"description": "Sets position of the icon. Note: \"left\" and \"right\" are deprecated. Use \"start\" and \"end\" instead"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "inoperableEvents",
|
|
191
|
+
"type": "string[]",
|
|
192
|
+
"description": "Events to prevent when the button is in an aria-disabled state"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "isAriaDisabled",
|
|
196
|
+
"type": "boolean",
|
|
197
|
+
"description": "Adds disabled styling and communicates that the button is disabled using the aria-disabled html attribute"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"name": "isBlock",
|
|
201
|
+
"type": "boolean",
|
|
202
|
+
"description": "Adds block styling to button"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "isCircle",
|
|
206
|
+
"type": "boolean",
|
|
207
|
+
"description": "Flag indicating the button is a circle button. Intended for buttons that only contain an icon..",
|
|
208
|
+
"beta": true
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"name": "isClicked",
|
|
212
|
+
"type": "boolean",
|
|
213
|
+
"description": "Adds clicked styling to button."
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"name": "isDanger",
|
|
217
|
+
"type": "boolean",
|
|
218
|
+
"description": "Adds danger styling to secondary or link button variants"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"name": "isDisabled",
|
|
222
|
+
"type": "boolean",
|
|
223
|
+
"description": "Adds disabled styling and disables the button using the disabled html attribute"
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "isDocked",
|
|
227
|
+
"type": "boolean",
|
|
228
|
+
"description": "Flag indicating the button is a docked variant button. For use in docked navigation.",
|
|
229
|
+
"beta": true
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"name": "isExpanded",
|
|
233
|
+
"type": "boolean",
|
|
234
|
+
"description": "Flag indicating whether content the button controls is expanded or not. Required when isHamburger is true."
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"name": "isFavorite",
|
|
238
|
+
"type": "boolean",
|
|
239
|
+
"description": "Adds favorite styling to a button"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"name": "isFavorited",
|
|
243
|
+
"type": "boolean",
|
|
244
|
+
"description": "Flag indicating whether the button is favorited or not, only when isFavorite is true."
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"name": "isHamburger",
|
|
248
|
+
"type": "boolean",
|
|
249
|
+
"description": "Flag indicating the button is a hamburger button. This will override the icon property."
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"name": "isInline",
|
|
253
|
+
"type": "boolean",
|
|
254
|
+
"description": "Adds inline styling to a link button"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"name": "isLoading",
|
|
258
|
+
"type": "boolean",
|
|
259
|
+
"description": "Adds progress styling to button"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"name": "isSettings",
|
|
263
|
+
"type": "boolean",
|
|
264
|
+
"description": "Flag indicating the button is a settings button. This will override the icon property."
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"name": "isTextExpanded",
|
|
268
|
+
"type": "boolean",
|
|
269
|
+
"description": "Flag indicating the docked button should display text. Only applies when isDocked is true.",
|
|
270
|
+
"beta": true
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "ouiaId",
|
|
274
|
+
"type": "number | string",
|
|
275
|
+
"description": "Value to overwrite the randomly generated data-ouia-component-id."
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"name": "ouiaSafe",
|
|
279
|
+
"type": "boolean",
|
|
280
|
+
"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."
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"name": "size",
|
|
284
|
+
"type": "'default' | 'sm' | 'lg'",
|
|
285
|
+
"description": "Adds styling which affects the size of the button"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"name": "spinnerAriaLabel",
|
|
289
|
+
"type": "string",
|
|
290
|
+
"description": "Accessible label for the spinner to describe what is loading"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"name": "spinnerAriaLabelledBy",
|
|
294
|
+
"type": "string",
|
|
295
|
+
"description": "Id of element which describes what is being loaded"
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"name": "spinnerAriaValueText",
|
|
299
|
+
"type": "string",
|
|
300
|
+
"description": "Text describing that current loading status or progress"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"name": "state",
|
|
304
|
+
"type": "'read' | 'unread' | 'attention'",
|
|
305
|
+
"description": "Sets state of the stateful button variant. Default is \"unread\""
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"name": "tabIndex",
|
|
309
|
+
"type": "number",
|
|
310
|
+
"description": "Sets the button tabindex."
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"name": "type",
|
|
314
|
+
"type": "'button' | 'submit' | 'reset'",
|
|
315
|
+
"description": "Sets button type"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"name": "variant",
|
|
319
|
+
"type": "'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning' | 'link' | 'plain' | 'control' | 'stateful'",
|
|
320
|
+
"description": "Adds button variant styles"
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"name": "FormSection",
|
|
326
|
+
"description": "",
|
|
327
|
+
"props": [
|
|
328
|
+
{
|
|
329
|
+
"name": "children",
|
|
330
|
+
"type": "React.ReactNode",
|
|
331
|
+
"description": "Content rendered inside the section"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"name": "className",
|
|
335
|
+
"type": "string",
|
|
336
|
+
"description": "Additional classes added to the section",
|
|
337
|
+
"defaultValue": "''"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"name": "title",
|
|
341
|
+
"type": "React.ReactNode",
|
|
342
|
+
"description": "Title for the section",
|
|
343
|
+
"defaultValue": "''"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"name": "titleElement",
|
|
347
|
+
"type": "'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'",
|
|
348
|
+
"description": "Element to wrap the section title",
|
|
349
|
+
"defaultValue": "'div'"
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"name": "FormHelperText",
|
|
355
|
+
"description": "",
|
|
356
|
+
"props": [
|
|
357
|
+
{
|
|
358
|
+
"name": "children",
|
|
359
|
+
"type": "React.ReactNode",
|
|
360
|
+
"description": "Content rendered inside the helper text wrapper",
|
|
361
|
+
"defaultValue": "null"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"name": "className",
|
|
365
|
+
"type": "string",
|
|
366
|
+
"description": "Additional classes added to the helper text wrapper",
|
|
367
|
+
"defaultValue": "''"
|
|
368
|
+
}
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"name": "FormFieldGroup",
|
|
373
|
+
"description": "",
|
|
374
|
+
"props": [
|
|
375
|
+
{
|
|
376
|
+
"name": "children",
|
|
377
|
+
"type": "React.ReactNode",
|
|
378
|
+
"description": "Anything that can be rendered as form field group content."
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"name": "className",
|
|
382
|
+
"type": "string",
|
|
383
|
+
"description": "Additional classes added to the form field group."
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"name": "header",
|
|
387
|
+
"type": "React.ReactNode",
|
|
388
|
+
"description": "Form field group header"
|
|
389
|
+
}
|
|
390
|
+
]
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"name": "FormFieldGroupExpandable",
|
|
394
|
+
"description": "",
|
|
395
|
+
"props": [
|
|
396
|
+
{
|
|
397
|
+
"name": "children",
|
|
398
|
+
"type": "React.ReactNode",
|
|
399
|
+
"description": "Anything that can be rendered as form field group content."
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"name": "className",
|
|
403
|
+
"type": "string",
|
|
404
|
+
"description": "Additional classes added to the form field group."
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"name": "hasAnimations",
|
|
408
|
+
"type": "boolean",
|
|
409
|
+
"description": "Flag indicating whether an expandable form field group has animations. This will always render\nnested field group content rather than dynamically rendering them. This prop will be removed in\nthe next breaking change release in favor of defaulting to always-rendered items."
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"name": "header",
|
|
413
|
+
"type": "React.ReactNode",
|
|
414
|
+
"description": "Form field group header"
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"name": "isExpanded",
|
|
418
|
+
"type": "boolean",
|
|
419
|
+
"description": "Flag indicating if the form field group is initially expanded",
|
|
420
|
+
"defaultValue": "false"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"name": "toggleAriaLabel",
|
|
424
|
+
"type": "string",
|
|
425
|
+
"description": "Aria-label to use on the form field group toggle button"
|
|
426
|
+
}
|
|
427
|
+
]
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"name": "FormFieldGroupHeader",
|
|
431
|
+
"description": "",
|
|
432
|
+
"props": [
|
|
433
|
+
{
|
|
434
|
+
"name": "actions",
|
|
435
|
+
"type": "React.ReactNode",
|
|
436
|
+
"description": "Field group header actions"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"name": "className",
|
|
440
|
+
"type": "string",
|
|
441
|
+
"description": "Additional classes added to the section"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"name": "titleDescription",
|
|
445
|
+
"type": "React.ReactNode",
|
|
446
|
+
"description": "Field group header title description"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"name": "titleText",
|
|
450
|
+
"type": "FormFieldGroupHeaderTitleTextObject",
|
|
451
|
+
"description": "Field group header title text"
|
|
452
|
+
}
|
|
453
|
+
]
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"name": "FormFieldGroupHeaderTitleTextObject",
|
|
457
|
+
"description": "",
|
|
458
|
+
"props": [
|
|
459
|
+
{
|
|
460
|
+
"name": "id",
|
|
461
|
+
"type": "string",
|
|
462
|
+
"description": "The id applied to the title div for accessibility",
|
|
463
|
+
"required": true
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"name": "text",
|
|
467
|
+
"type": "React.ReactNode",
|
|
468
|
+
"description": "Title text.",
|
|
469
|
+
"required": true
|
|
470
|
+
}
|
|
471
|
+
]
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"name": "FormContextProps",
|
|
475
|
+
"description": "",
|
|
476
|
+
"props": [
|
|
477
|
+
{
|
|
478
|
+
"name": "errors",
|
|
479
|
+
"type": "Record<string, string>",
|
|
480
|
+
"description": "Record of errors for all fieldIds",
|
|
481
|
+
"required": true
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
"name": "getError",
|
|
485
|
+
"type": "string",
|
|
486
|
+
"description": "Get the error message for a given fieldId",
|
|
487
|
+
"required": true
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"name": "getValue",
|
|
491
|
+
"type": "string",
|
|
492
|
+
"description": "Get the value for a given fieldId",
|
|
493
|
+
"required": true
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
"name": "isTouched",
|
|
497
|
+
"type": "boolean",
|
|
498
|
+
"description": "Used to determine touched state for a given fieldId",
|
|
499
|
+
"required": true
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
"name": "isValid",
|
|
503
|
+
"type": "boolean",
|
|
504
|
+
"description": "Flag to determine the overall validity. True if the record of errors is empty.",
|
|
505
|
+
"required": true
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"name": "setError",
|
|
509
|
+
"type": "void",
|
|
510
|
+
"description": "Set the error message for a given fieldId",
|
|
511
|
+
"required": true
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"name": "setErrors",
|
|
515
|
+
"type": "Dispatch<SetStateAction<Record<string, string>>>",
|
|
516
|
+
"description": "Set multiple errors within the managed record of errors",
|
|
517
|
+
"required": true
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
"name": "setTouched",
|
|
521
|
+
"type": "void",
|
|
522
|
+
"description": "Used to update the touched state for a given fieldId",
|
|
523
|
+
"required": true
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
"name": "setValidator",
|
|
527
|
+
"type": "void",
|
|
528
|
+
"description": "Set a validator for a specific fieldId",
|
|
529
|
+
"required": true
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"name": "setValue",
|
|
533
|
+
"type": "void",
|
|
534
|
+
"description": "Set the value for a given fieldId",
|
|
535
|
+
"required": true
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"name": "setValues",
|
|
539
|
+
"type": "Dispatch<SetStateAction<Record<string, string>>>",
|
|
540
|
+
"description": "Set multiple values within the managed record of values",
|
|
541
|
+
"required": true
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"name": "touched",
|
|
545
|
+
"type": "Record<string, boolean>",
|
|
546
|
+
"description": "Record of touched state for all fieldIds",
|
|
547
|
+
"required": true
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
"name": "validate",
|
|
551
|
+
"type": "Record<string, string | null>",
|
|
552
|
+
"description": "Triggers all fieldId-specific validators",
|
|
553
|
+
"required": true
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"name": "values",
|
|
557
|
+
"type": "Record<string, string>",
|
|
558
|
+
"description": "Record of values for all fieldIds",
|
|
559
|
+
"required": true
|
|
560
|
+
}
|
|
561
|
+
]
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
"name": "FormContextProviderProps",
|
|
565
|
+
"description": "",
|
|
566
|
+
"props": [
|
|
567
|
+
{
|
|
568
|
+
"name": "children",
|
|
569
|
+
"type": "React.ReactNode | ((props: FormContextProps) => React.ReactNode)",
|
|
570
|
+
"description": "Any react node. Can optionally use render function to return context props."
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"name": "initialValues",
|
|
574
|
+
"type": "Record<string, string>",
|
|
575
|
+
"description": "Record of initial values"
|
|
576
|
+
}
|
|
577
|
+
]
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
"name": "Button",
|
|
581
|
+
"description": "",
|
|
582
|
+
"props": [
|
|
583
|
+
{
|
|
584
|
+
"name": "aria-label",
|
|
585
|
+
"type": "string",
|
|
586
|
+
"description": "Adds accessible text to the button."
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
"name": "children",
|
|
590
|
+
"type": "React.ReactNode",
|
|
591
|
+
"description": "Content rendered inside the button"
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
"name": "className",
|
|
595
|
+
"type": "string",
|
|
596
|
+
"description": "Additional classes added to the button"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
"name": "component",
|
|
600
|
+
"type": "React.ElementType<any> | React.ComponentType<any>",
|
|
601
|
+
"description": "Sets the base component to render. defaults to button"
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
"name": "countOptions",
|
|
605
|
+
"type": "BadgeCountObject",
|
|
606
|
+
"description": "Adds count number to button"
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
"name": "hamburgerVariant",
|
|
610
|
+
"type": "'expand' | 'collapse'",
|
|
611
|
+
"description": "Adjusts and animates the hamburger icon to indicate what will happen upon clicking the button."
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"name": "hasNoPadding",
|
|
615
|
+
"type": "boolean",
|
|
616
|
+
"description": "Applies no padding on a plain button variant. Use when plain button is placed inline with text"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
"name": "icon",
|
|
620
|
+
"type": "React.ReactNode | null",
|
|
621
|
+
"description": "Icon for the button."
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
"name": "iconPosition",
|
|
625
|
+
"type": "'start' | 'end' | 'left' | 'right'",
|
|
626
|
+
"description": "Sets position of the icon. Note: \"left\" and \"right\" are deprecated. Use \"start\" and \"end\" instead"
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
"name": "inoperableEvents",
|
|
630
|
+
"type": "string[]",
|
|
631
|
+
"description": "Events to prevent when the button is in an aria-disabled state"
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
"name": "isAriaDisabled",
|
|
635
|
+
"type": "boolean",
|
|
636
|
+
"description": "Adds disabled styling and communicates that the button is disabled using the aria-disabled html attribute"
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"name": "isBlock",
|
|
640
|
+
"type": "boolean",
|
|
641
|
+
"description": "Adds block styling to button"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
"name": "isCircle",
|
|
645
|
+
"type": "boolean",
|
|
646
|
+
"description": "Flag indicating the button is a circle button. Intended for buttons that only contain an icon..",
|
|
647
|
+
"beta": true
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
"name": "isClicked",
|
|
651
|
+
"type": "boolean",
|
|
652
|
+
"description": "Adds clicked styling to button."
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"name": "isDanger",
|
|
656
|
+
"type": "boolean",
|
|
657
|
+
"description": "Adds danger styling to secondary or link button variants"
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
"name": "isDisabled",
|
|
661
|
+
"type": "boolean",
|
|
662
|
+
"description": "Adds disabled styling and disables the button using the disabled html attribute"
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
"name": "isDocked",
|
|
666
|
+
"type": "boolean",
|
|
667
|
+
"description": "Flag indicating the button is a docked variant button. For use in docked navigation.",
|
|
668
|
+
"beta": true
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
"name": "isExpanded",
|
|
672
|
+
"type": "boolean",
|
|
673
|
+
"description": "Flag indicating whether content the button controls is expanded or not. Required when isHamburger is true."
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
"name": "isFavorite",
|
|
677
|
+
"type": "boolean",
|
|
678
|
+
"description": "Adds favorite styling to a button"
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
"name": "isFavorited",
|
|
682
|
+
"type": "boolean",
|
|
683
|
+
"description": "Flag indicating whether the button is favorited or not, only when isFavorite is true."
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
"name": "isHamburger",
|
|
687
|
+
"type": "boolean",
|
|
688
|
+
"description": "Flag indicating the button is a hamburger button. This will override the icon property."
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
"name": "isInline",
|
|
692
|
+
"type": "boolean",
|
|
693
|
+
"description": "Adds inline styling to a link button"
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
"name": "isLoading",
|
|
697
|
+
"type": "boolean",
|
|
698
|
+
"description": "Adds progress styling to button"
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
"name": "isSettings",
|
|
702
|
+
"type": "boolean",
|
|
703
|
+
"description": "Flag indicating the button is a settings button. This will override the icon property."
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
"name": "isTextExpanded",
|
|
707
|
+
"type": "boolean",
|
|
708
|
+
"description": "Flag indicating the docked button should display text. Only applies when isDocked is true.",
|
|
709
|
+
"beta": true
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
"name": "ouiaId",
|
|
713
|
+
"type": "number | string",
|
|
714
|
+
"description": "Value to overwrite the randomly generated data-ouia-component-id."
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
"name": "ouiaSafe",
|
|
718
|
+
"type": "boolean",
|
|
719
|
+
"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."
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
"name": "size",
|
|
723
|
+
"type": "'default' | 'sm' | 'lg'",
|
|
724
|
+
"description": "Adds styling which affects the size of the button"
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
"name": "spinnerAriaLabel",
|
|
728
|
+
"type": "string",
|
|
729
|
+
"description": "Accessible label for the spinner to describe what is loading"
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
"name": "spinnerAriaLabelledBy",
|
|
733
|
+
"type": "string",
|
|
734
|
+
"description": "Id of element which describes what is being loaded"
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
"name": "spinnerAriaValueText",
|
|
738
|
+
"type": "string",
|
|
739
|
+
"description": "Text describing that current loading status or progress"
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
"name": "state",
|
|
743
|
+
"type": "'read' | 'unread' | 'attention'",
|
|
744
|
+
"description": "Sets state of the stateful button variant. Default is \"unread\""
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
"name": "tabIndex",
|
|
748
|
+
"type": "number",
|
|
749
|
+
"description": "Sets the button tabindex."
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
"name": "type",
|
|
753
|
+
"type": "'button' | 'submit' | 'reset'",
|
|
754
|
+
"description": "Sets button type"
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
"name": "variant",
|
|
758
|
+
"type": "'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning' | 'link' | 'plain' | 'control' | 'stateful'",
|
|
759
|
+
"description": "Adds button variant styles"
|
|
760
|
+
}
|
|
761
|
+
]
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
"name": "Popover",
|
|
765
|
+
"description": "The main popover component. The following properties can also be passed into another component\nthat has a property specifically for passing in popover properties.",
|
|
766
|
+
"props": [
|
|
767
|
+
{
|
|
768
|
+
"name": "alertSeverityScreenReaderText",
|
|
769
|
+
"type": "string",
|
|
770
|
+
"description": "Text announced by screen reader when alert severity variant is set to indicate\nseverity level."
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
"name": "alertSeverityVariant",
|
|
774
|
+
"type": "'custom' | 'info' | 'warning' | 'success' | 'danger'",
|
|
775
|
+
"description": "Severity variants for an alert popover. This modifies the color of the header to\nmatch the severity."
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
"name": "animationDuration",
|
|
779
|
+
"type": "number",
|
|
780
|
+
"description": "The duration of the CSS fade transition animation.",
|
|
781
|
+
"defaultValue": "300"
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
"name": "appendTo",
|
|
785
|
+
"type": "HTMLElement | ((ref?: HTMLElement) => HTMLElement) | 'inline'",
|
|
786
|
+
"description": "The element to append the popover to. Defaults to \"inline\".",
|
|
787
|
+
"defaultValue": "() => document.body"
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
"name": "aria-label",
|
|
791
|
+
"type": "string",
|
|
792
|
+
"description": "Accessible label for the popover, required when header is not present.",
|
|
793
|
+
"defaultValue": "''"
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
"name": "bodyContent",
|
|
797
|
+
"type": "React.ReactNode | ((hide: () => void) => React.ReactNode)",
|
|
798
|
+
"description": "Body content of the popover. If you want to close the popover after an action within the\nbody content, you can use the isVisible prop for manual control, or you can provide a\nfunction which will receive a callback as an argument to hide the popover, i.e.\nbodyContent={hide => <Button onClick={() => hide()}>Close</Button>}",
|
|
799
|
+
"required": true
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
"name": "children",
|
|
803
|
+
"type": "ReactElement<any>",
|
|
804
|
+
"description": "The trigger reference element to which the popover is relatively placed to. If you cannot wrap\nthe element with the Popover, you can use the triggerRef prop instead.\nUsage: <Popover><Button>Reference</Button></Popover>"
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
"name": "className",
|
|
808
|
+
"type": "string",
|
|
809
|
+
"description": "Additional classes added to the popover.",
|
|
810
|
+
"defaultValue": "''"
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
"name": "closeBtnAriaLabel",
|
|
814
|
+
"type": "string",
|
|
815
|
+
"description": "Accessible label for the close button.",
|
|
816
|
+
"defaultValue": "'Close'"
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
"name": "distance",
|
|
820
|
+
"type": "number",
|
|
821
|
+
"description": "Distance of the popover to its target. Defaults to 25.",
|
|
822
|
+
"defaultValue": "25"
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
"name": "elementToFocus",
|
|
826
|
+
"type": "HTMLElement | SVGElement | string",
|
|
827
|
+
"description": "The element to focus when the popover becomes visible. By default the first\nfocusable element will receive focus."
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
"name": "enableFlip",
|
|
831
|
+
"type": "boolean",
|
|
832
|
+
"description": "If true, tries to keep the popover in view by flipping it if necessary.\nIf the position is set to 'auto', this prop is ignored.",
|
|
833
|
+
"defaultValue": "true"
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
"name": "flipBehavior",
|
|
837
|
+
"type": "| 'flip'\n| (\n | 'top'\n | 'bottom'\n | 'left'\n | 'right'\n | 'top-start'\n | 'top-end'\n | 'bottom-start'\n | 'bottom-end'\n | 'left-start'\n | 'left-end'\n | 'right-start'\n | 'right-end'\n )[]",
|
|
838
|
+
"description": "The desired position to flip the popover to if the initial position is not possible.\nBy setting this prop to 'flip' it attempts to flip the popover to the opposite side if\nthere is no space.\nYou can also pass an array of positions that determines the flip order. It should contain\nthe initial position followed by alternative positions if that position is unavailable.\nExample: Initial position is 'top'. Button with popover is in the top right corner.\n'flipBehavior' is set to ['top', 'right', 'left']. Since there is no space to the top, it\nchecks if right is available. There's also no space to the right, so it finally shows the\npopover on the left.",
|
|
839
|
+
"defaultValue": "[\n 'top',\n 'bottom',\n 'left',\n 'right',\n 'top-start',\n 'top-end',\n 'bottom-start',\n 'bottom-end',\n 'left-start',\n 'left-end',\n 'right-start',\n 'right-end'\n]"
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
"name": "footerContent",
|
|
843
|
+
"type": "React.ReactNode | ((hide: () => void) => React.ReactNode)",
|
|
844
|
+
"description": "Footer content of the popover. If you want to close the popover after an action within the\nfooter content, you can use the isVisible prop for manual control, or you can provide a\nfunction which will receive a callback as an argument to hide the popover, i.e.\nfooterContent={hide => <Button onClick={() => hide()}>Close</Button>}",
|
|
845
|
+
"defaultValue": "null"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
"name": "hasAutoWidth",
|
|
849
|
+
"type": "boolean",
|
|
850
|
+
"description": "Removes fixed-width and allows width to be defined by contents.",
|
|
851
|
+
"defaultValue": "false"
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
"name": "hasNoPadding",
|
|
855
|
+
"type": "boolean",
|
|
856
|
+
"description": "Allows content to touch edges of popover container.",
|
|
857
|
+
"defaultValue": "false"
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
"name": "headerComponent",
|
|
861
|
+
"type": "'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'",
|
|
862
|
+
"description": "Sets the heading level to use for the popover header. Defaults to h6.",
|
|
863
|
+
"defaultValue": "'h6'"
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
"name": "headerContent",
|
|
867
|
+
"type": "React.ReactNode | ((hide: () => void) => React.ReactNode)",
|
|
868
|
+
"description": "Simple header content to be placed within a title. If you want to close the popover after\nan action within the header content, you can use the isVisible prop for manual control,\nor you can provide a function which will receive a callback as an argument to hide the\npopover, i.e. headerContent={hide => <Button onClick={() => hide()}>Close</Button>}",
|
|
869
|
+
"defaultValue": "null"
|
|
870
|
+
},
|
|
871
|
+
{
|
|
872
|
+
"name": "headerIcon",
|
|
873
|
+
"type": "React.ReactNode",
|
|
874
|
+
"description": "Icon to be displayed in the popover header. *",
|
|
875
|
+
"defaultValue": "null"
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
"name": "hideOnOutsideClick",
|
|
879
|
+
"type": "boolean",
|
|
880
|
+
"description": "Hides the popover when a click occurs outside (only works if isVisible is not controlled\nby the user).",
|
|
881
|
+
"defaultValue": "true"
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
"name": "id",
|
|
885
|
+
"type": "string",
|
|
886
|
+
"description": "Id used as part of the various popover elements (popover-${id}-header/body/footer)."
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
"name": "isVisible",
|
|
890
|
+
"type": "boolean",
|
|
891
|
+
"description": "True to show the popover programmatically. Used in conjunction with the shouldClose prop.\nBy default, the popover child element handles click events automatically. If you want to\ncontrol this programmatically, the popover will not auto-close if the close button is\nclicked, the escape key is used, or if a click occurs outside the popover. Instead, the\nconsumer is responsible for closing the popover themselves by adding a callback listener\nfor the shouldClose prop.",
|
|
892
|
+
"defaultValue": "null"
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
"name": "maxWidth",
|
|
896
|
+
"type": "string",
|
|
897
|
+
"description": "Maximum width of the popover (default 18.75rem).",
|
|
898
|
+
"defaultValue": "popoverMaxWidth && popoverMaxWidth.value"
|
|
899
|
+
},
|
|
900
|
+
{
|
|
901
|
+
"name": "minWidth",
|
|
902
|
+
"type": "string",
|
|
903
|
+
"description": "Minimum width of the popover (default 6.25rem).",
|
|
904
|
+
"defaultValue": "popoverMinWidth && popoverMinWidth.value"
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
"name": "onHidden",
|
|
908
|
+
"type": "() => void",
|
|
909
|
+
"description": "Lifecycle function invoked when the popover has fully transitioned out.",
|
|
910
|
+
"defaultValue": "(): void => null"
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
"name": "onHide",
|
|
914
|
+
"type": "(event: MouseEvent | KeyboardEvent) => void",
|
|
915
|
+
"description": "Lifecycle function invoked when the popover begins to transition out.",
|
|
916
|
+
"defaultValue": "(): void => null"
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
"name": "onMount",
|
|
920
|
+
"type": "() => void",
|
|
921
|
+
"description": "Lifecycle function invoked when the popover has been mounted to the DOM.",
|
|
922
|
+
"defaultValue": "(): void => null"
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
"name": "onShow",
|
|
926
|
+
"type": "(event: MouseEvent | KeyboardEvent) => void",
|
|
927
|
+
"description": "Lifecycle function invoked when the popover begins to transition in.",
|
|
928
|
+
"defaultValue": "(): void => null"
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
"name": "onShown",
|
|
932
|
+
"type": "() => void",
|
|
933
|
+
"description": "Lifecycle function invoked when the popover has fully transitioned in.",
|
|
934
|
+
"defaultValue": "(): void => null"
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
"name": "position",
|
|
938
|
+
"type": "| PopoverPosition\n| 'auto'\n| 'top'\n| 'bottom'\n| 'left'\n| 'right'\n| 'top-start'\n| 'top-end'\n| 'bottom-start'\n| 'bottom-end'\n| 'left-start'\n| 'left-end'\n| 'right-start'\n| 'right-end'",
|
|
939
|
+
"description": "Popover position. Note: With the enableFlip property set to true, it will change the\nposition if there is not enough space for the starting position. The behavior of where it\nflips to can be controlled through the flipBehavior property.",
|
|
940
|
+
"defaultValue": "'top'"
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
"name": "shouldClose",
|
|
944
|
+
"type": "(event: MouseEvent | KeyboardEvent, hideFunction?: () => void) => void",
|
|
945
|
+
"description": "Callback function that is only invoked when isVisible is also controlled. Called when the\npopover close button is clicked, the enter key was used on it, or the escape key is used.",
|
|
946
|
+
"defaultValue": "(): void => null"
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
"name": "shouldOpen",
|
|
950
|
+
"type": "(event: MouseEvent | KeyboardEvent, showFunction?: () => void) => void",
|
|
951
|
+
"description": "Callback function that is only invoked when isVisible is also controlled. Called when the\nenter key is used on the focused trigger.",
|
|
952
|
+
"defaultValue": "(): void => null"
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
"name": "showClose",
|
|
956
|
+
"type": "boolean",
|
|
957
|
+
"description": "Flag indicating whether the close button should be shown.",
|
|
958
|
+
"defaultValue": "true"
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
"name": "triggerAction",
|
|
962
|
+
"type": "'click' | 'hover'",
|
|
963
|
+
"description": "Sets an interaction to open popover, defaults to \"click\"",
|
|
964
|
+
"defaultValue": "'click'"
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
"name": "triggerRef",
|
|
968
|
+
"type": "HTMLElement | (() => HTMLElement) | React.RefObject<any>",
|
|
969
|
+
"description": "The trigger reference element to which the popover is relatively placed to. If you can wrap the\nelement with the popover, you can use the children prop instead, or both props together.\nWhen passed along with the trigger prop, the div element that wraps the trigger will be removed.\nUsage: <Popover triggerRef={() => document.getElementById('reference-element')} />"
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
"name": "withFocusTrap",
|
|
973
|
+
"type": "boolean",
|
|
974
|
+
"description": "Whether to trap focus in the popover."
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
"name": "zIndex",
|
|
978
|
+
"type": "number",
|
|
979
|
+
"description": "The z-index of the popover.",
|
|
980
|
+
"defaultValue": "9999"
|
|
981
|
+
}
|
|
982
|
+
]
|
|
983
|
+
}
|
|
984
|
+
],
|
|
985
|
+
"cssPrefix": [
|
|
986
|
+
"pf-v6-c-form"
|
|
987
|
+
],
|
|
988
|
+
"examples": [
|
|
989
|
+
"Basic",
|
|
990
|
+
"Horizontal",
|
|
991
|
+
"Limit width",
|
|
992
|
+
"Invalid",
|
|
993
|
+
"Invalid with form alert",
|
|
994
|
+
"Validated",
|
|
995
|
+
"Horizontal stacked no padding top",
|
|
996
|
+
"Horizontal stacked helper text on top",
|
|
997
|
+
"Form group with additional label info",
|
|
998
|
+
"Form Sections",
|
|
999
|
+
"Grid form",
|
|
1000
|
+
"Field Groups",
|
|
1001
|
+
"Form state"
|
|
1002
|
+
]
|
|
1003
|
+
};
|
|
1004
|
+
pageData.liveContext = {
|
|
1005
|
+
useRef,
|
|
1006
|
+
useEffect,
|
|
1007
|
+
useState,
|
|
1008
|
+
RhUiErrorFillIcon,
|
|
1009
|
+
HelpIcon,
|
|
1010
|
+
TrashIcon,
|
|
1011
|
+
styles
|
|
1012
|
+
};
|
|
1013
|
+
pageData.examples = {
|
|
1014
|
+
'Basic': props =>
|
|
1015
|
+
<Example {...pageData} {...props} {...{"code":"import { useRef, useState } from 'react';\nimport {\n Form,\n FormGroup,\n TextInput,\n Checkbox,\n Popover,\n ActionGroup,\n Button,\n Radio,\n HelperText,\n HelperTextItem,\n FormHelperText,\n FormGroupLabelHelp\n} from '@patternfly/react-core';\n\nexport const FormBasic: React.FunctionComponent = () => {\n const [name, setName] = useState('');\n const [email, setEmail] = useState('');\n const [phone, setPhone] = useState('');\n const labelHelpRef = useRef(null);\n\n const handleNameChange = (_event, name: string) => {\n setName(name);\n };\n\n const handleEmailChange = (_event, email: string) => {\n setEmail(email);\n };\n\n const handlePhoneChange = (_event, phone: string) => {\n setPhone(phone);\n };\n\n return (\n <Form>\n <FormGroup\n label=\"Full name\"\n labelHelp={\n <Popover\n triggerRef={labelHelpRef}\n headerContent={\n <div>\n The{' '}\n <a href=\"https://schema.org/name\" target=\"_blank\" rel=\"noreferrer\">\n name\n </a>{' '}\n of a{' '}\n <a href=\"https://schema.org/Person\" target=\"_blank\" rel=\"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=\"noreferrer\">\n givenName\n </a>{' '}\n and{' '}\n <a href=\"https://schema.org/familyName\" target=\"_blank\" rel=\"noreferrer\">\n familyName\n </a>\n .\n </div>\n }\n >\n <FormGroupLabelHelp ref={labelHelpRef} aria-label=\"More info for name field\" />\n </Popover>\n }\n isRequired\n fieldId=\"simple-form-name-01\"\n >\n <TextInput\n isRequired\n type=\"text\"\n id=\"simple-form-name-01\"\n name=\"simple-form-name-01\"\n aria-describedby=\"simple-form-name-01-helper\"\n value={name}\n onChange={handleNameChange}\n />\n <FormHelperText>\n <HelperText>\n <HelperTextItem>Include your middle name if you have one.</HelperTextItem>\n </HelperText>\n </FormHelperText>\n </FormGroup>\n <FormGroup label=\"Email\" isRequired fieldId=\"simple-form-email-01\">\n <TextInput\n isRequired\n type=\"email\"\n id=\"simple-form-email-01\"\n name=\"simple-form-email-01\"\n value={email}\n onChange={handleEmailChange}\n />\n </FormGroup>\n <FormGroup label=\"Phone number\" isRequired fieldId=\"simple-form-phone-01\">\n <TextInput\n isRequired\n type=\"tel\"\n id=\"simple-form-phone-01\"\n name=\"simple-form-phone-01\"\n placeholder=\"555-555-5555\"\n value={phone}\n onChange={handlePhoneChange}\n />\n </FormGroup>\n <FormGroup role=\"group\" isInline fieldId=\"basic-form-checkbox-group\" label=\"How can we contact you?\">\n <Checkbox label=\"Email\" aria-label=\"Email\" id=\"inlinecheck01\" />\n <Checkbox label=\"Phone\" aria-label=\"Phone\" id=\"inlinecheck02\" />\n <Checkbox label=\"Mail\" aria-label=\"Mail\" id=\"inlinecheck03\" />\n </FormGroup>\n <FormGroup role=\"radiogroup\" isInline fieldId=\"basic-form-radio-group\" label=\"Time zone\">\n <Radio name=\"basic-inline-radio\" label=\"Eastern\" id=\"basic-inline-radio-01\" />\n <Radio name=\"basic-inline-radio\" label=\"Central\" id=\"basic-inline-radio-02\" />\n <Radio name=\"basic-inline-radio\" label=\"Pacific\" id=\"basic-inline-radio-03\" />\n </FormGroup>\n <FormGroup label=\"Additional note\" fieldId=\"simple-form-note-01\">\n <TextInput isDisabled type=\"text\" id=\"simple-form-note-01\" name=\"simple-form-number\" value=\"disabled\" />\n </FormGroup>\n <FormGroup fieldId=\"checkbox01\">\n <Checkbox label=\"I'd like updates via email.\" id=\"checkbox01\" name=\"checkbox01\" aria-label=\"Update via email\" />\n </FormGroup>\n <ActionGroup>\n <Button variant=\"primary\">Submit</Button>\n <Button variant=\"link\">Cancel</Button>\n </ActionGroup>\n </Form>\n );\n};\n","title":"Basic","lang":"ts","className":""}}>
|
|
1016
|
+
|
|
1017
|
+
</Example>,
|
|
1018
|
+
'Horizontal': props =>
|
|
1019
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n Form,\n FormGroup,\n TextInput,\n TextArea,\n FormSelect,\n FormSelectOption,\n Checkbox,\n ActionGroup,\n Button,\n Radio,\n HelperText,\n HelperTextItem,\n FormHelperText\n} from '@patternfly/react-core';\n\nexport const FormHorizontal: React.FunctionComponent = () => {\n const [name, setName] = useState('');\n const [email, setEmail] = useState('');\n const [experience, setExperience] = useState('');\n const [option, setOption] = useState('please choose');\n\n const handleNameChange = (_event, name: string) => {\n setName(name);\n };\n\n const handleEmailChange = (_event, email: string) => {\n setEmail(email);\n };\n\n const handleExperienceChange = (_event, experience: string) => {\n setExperience(experience);\n };\n\n const handleOptionChange = (_event: React.FormEvent<HTMLSelectElement>, value: string) => {\n setOption(value);\n };\n\n const options = [\n { value: 'select one', label: 'Select one', disabled: false },\n { value: 'mr', label: 'Mr', disabled: false },\n { value: 'miss', label: 'Miss', disabled: false },\n { value: 'mrs', label: 'Mrs', disabled: false },\n { value: 'ms', label: 'Ms', disabled: false },\n { value: 'dr', label: 'Dr', disabled: false },\n { value: 'other', label: 'Other', disabled: false }\n ];\n\n return (\n <Form isHorizontal>\n <FormGroup label=\"Full name\" isRequired fieldId=\"horizontal-form-name\">\n <TextInput\n value={name}\n isRequired\n type=\"text\"\n id=\"horizontal-form-name\"\n aria-describedby=\"horizontal-form-name-helper\"\n name=\"horizontal-form-name\"\n onChange={handleNameChange}\n />\n <FormHelperText>\n <HelperText>\n <HelperTextItem>Include your middle name if you have one.</HelperTextItem>\n </HelperText>\n </FormHelperText>\n </FormGroup>\n <FormGroup label=\"Email\" isRequired fieldId=\"horizontal-form-email\">\n <TextInput\n value={email}\n isRequired\n type=\"email\"\n id=\"horizontal-form-email\"\n name=\"horizontal-form-email\"\n onChange={handleEmailChange}\n />\n </FormGroup>\n <FormGroup label=\"Your title\" fieldId=\"horizontal-form-title\">\n <FormSelect\n value={option}\n onChange={handleOptionChange}\n id=\"horizontal-form-title\"\n name=\"horizontal-form-title\"\n aria-label=\"Your title\"\n >\n {options.map((option, index) => (\n <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.label} />\n ))}\n </FormSelect>\n </FormGroup>\n <FormGroup label=\"Your experience\" fieldId=\"horizontal-form-exp\">\n <TextArea\n value={experience}\n onChange={handleExperienceChange}\n id=\"horizontal-form-exp\"\n name=\"horizontal-form-exp\"\n />\n </FormGroup>\n <FormGroup\n label=\"How can we contact you?\"\n isStack\n fieldId=\"horizontal-form-checkbox-group\"\n hasNoPaddingTop\n role=\"group\"\n >\n <Checkbox label=\"Email\" id=\"alt-form-checkbox-1\" name=\"alt-form-checkbox-1\" />\n <Checkbox label=\"Phone\" id=\"alt-form-checkbox-2\" name=\"alt-form-checkbox-2\" />\n <Checkbox label=\"Mail\" id=\"alt-form-checkbox-3\" name=\"alt-form-checkbox-3\" />\n </FormGroup>\n <FormGroup role=\"radiogroup\" isStack fieldId=\"horizontal-form-radio-group\" hasNoPaddingTop label=\"Time zone\">\n <Radio name=\"horizontal-inline-radio\" label=\"Eastern\" id=\"horizontal-inline-radio-01\" />\n <Radio name=\"horizontal-inline-radio\" label=\"Central\" id=\"horizontal-inline-radio-02\" />\n <Radio name=\"horizontal-inline-radio\" label=\"Pacific\" id=\"horizontal-inline-radio-03\" />\n </FormGroup>\n <ActionGroup>\n <Button variant=\"primary\">Submit</Button>\n <Button variant=\"link\">Cancel</Button>\n </ActionGroup>\n </Form>\n );\n};\n","title":"Horizontal","lang":"ts","className":""}}>
|
|
1020
|
+
|
|
1021
|
+
</Example>,
|
|
1022
|
+
'Limit width': props =>
|
|
1023
|
+
<Example {...pageData} {...props} {...{"code":"import { useRef, useState } from 'react';\nimport {\n Form,\n FormGroup,\n TextInput,\n Checkbox,\n Popover,\n ActionGroup,\n Button,\n Radio,\n HelperText,\n HelperTextItem,\n FormHelperText,\n FormGroupLabelHelp\n} from '@patternfly/react-core';\n\nexport const FormLimitWidth: React.FunctionComponent = () => {\n const [name, setName] = useState('');\n const [email, setEmail] = useState('');\n const [phone, setPhone] = useState('');\n const labelHelpRef = useRef(null);\n\n const handleNameChange = (_event, name: string) => {\n setName(name);\n };\n\n const handleEmailChange = (_event, email: string) => {\n setEmail(email);\n };\n\n const handlePhoneChange = (_event, phone: string) => {\n setPhone(phone);\n };\n\n return (\n <Form isWidthLimited>\n <FormGroup\n label=\"Full name\"\n labelHelp={\n <Popover\n triggerRef={labelHelpRef}\n headerContent={\n <div>\n The{' '}\n <a href=\"https://schema.org/name\" target=\"_blank\" rel=\"noreferrer\">\n name\n </a>{' '}\n of a{' '}\n <a href=\"https://schema.org/Person\" target=\"_blank\" rel=\"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=\"noreferrer\">\n givenName\n </a>{' '}\n and{' '}\n <a href=\"https://schema.org/familyName\" target=\"_blank\" rel=\"noreferrer\">\n familyName\n </a>\n .\n </div>\n }\n >\n <FormGroupLabelHelp ref={labelHelpRef} aria-label=\"More info for name field\" />\n </Popover>\n }\n isRequired\n fieldId=\"simple-form-name-02\"\n >\n <TextInput\n isRequired\n type=\"text\"\n id=\"simple-form-name-02\"\n name=\"simple-form-name-02\"\n aria-describedby=\"simple-form-name-02-helper\"\n value={name}\n onChange={handleNameChange}\n />\n <FormHelperText>\n <HelperText>\n <HelperTextItem>Include your middle name if you have one.</HelperTextItem>\n </HelperText>\n </FormHelperText>\n </FormGroup>\n <FormGroup label=\"Email\" isRequired fieldId=\"simple-form-email-02\">\n <TextInput\n isRequired\n type=\"email\"\n id=\"simple-form-email-02\"\n name=\"simple-form-email-02\"\n value={email}\n onChange={handleEmailChange}\n />\n </FormGroup>\n <FormGroup label=\"Phone number\" isRequired fieldId=\"simple-form-number\">\n <TextInput\n isRequired\n type=\"tel\"\n placeholder=\"555-555-5555\"\n id=\"simple-form-number\"\n name=\"simple-form-number\"\n value={phone}\n onChange={handlePhoneChange}\n />\n </FormGroup>\n <FormGroup role=\"group\" isInline fieldId=\"limit-width-form-checkbox-group\" label=\"How can we contact you?\">\n <Checkbox label=\"Email\" aria-label=\"Email\" id=\"inlinecheck04\" />\n <Checkbox label=\"Phone\" aria-label=\"Phone\" id=\"inlinecheck05\" />\n <Checkbox label=\"Mail\" aria-label=\"Mail\" id=\"inlinecheck06\" />\n </FormGroup>\n <FormGroup role=\"radiogroup\" isInline fieldId=\"limit-width-form-radio-group\" label=\"Time zone\">\n <Radio name=\"limit-width-radio\" label=\"Eastern\" id=\"limit-width-inline-radio-01\" />\n <Radio name=\"limit-width-radio\" label=\"Central\" id=\"limit-width-inline-radio-02\" />\n <Radio name=\"limit-width-radio\" label=\"Pacific\" id=\"limit-width-inline-radio-03\" />\n </FormGroup>\n <FormGroup label=\"Additional note\" fieldId=\"simple-form-note-02\">\n <TextInput isDisabled type=\"text\" id=\"simple-form-note-02\" name=\"simple-form-number\" value=\"disabled\" />\n </FormGroup>\n <FormGroup fieldId=\"checkbox02\">\n <Checkbox label=\"I'd like updates via email.\" id=\"checkbox02\" name=\"checkbox02\" aria-label=\"Update via email\" />\n </FormGroup>\n <ActionGroup>\n <Button variant=\"primary\">Submit</Button>\n <Button variant=\"link\">Cancel</Button>\n </ActionGroup>\n </Form>\n );\n};\n","title":"Limit width","lang":"ts","className":""}}>
|
|
1024
|
+
|
|
1025
|
+
</Example>,
|
|
1026
|
+
'Invalid': props =>
|
|
1027
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Form, FormGroup, TextInput, HelperText, HelperTextItem, FormHelperText } from '@patternfly/react-core';\nimport RhUiErrorFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-error-fill-icon';\n\nexport const FormInvalid: React.FunctionComponent = () => {\n type validate = 'success' | 'warning' | 'error' | 'default';\n\n const [age, setAge] = useState('Five');\n const [validated, setValidated] = useState<validate>('error');\n\n const handleAgeChange = (_event, age: string) => {\n setAge(age);\n if (age === '') {\n setValidated('default');\n } else if (/^\\d+$/.test(age)) {\n setValidated('success');\n } else {\n setValidated('error');\n }\n };\n\n return (\n <Form>\n <FormGroup label=\"Age\" type=\"number\" fieldId=\"age-1\">\n <TextInput\n validated={validated}\n value={age}\n id=\"age-1\"\n aria-describedby=\"age-1-helper\"\n onChange={handleAgeChange}\n />\n {validated !== 'success' && (\n <FormHelperText>\n <HelperText>\n <HelperTextItem icon={<RhUiErrorFillIcon />} variant={validated}>\n {validated === 'error' ? 'Must be a number' : 'Please enter your age'}\n </HelperTextItem>\n </HelperText>\n </FormHelperText>\n )}\n </FormGroup>\n </Form>\n );\n};\n","title":"Invalid","lang":"ts","className":""}}>
|
|
1028
|
+
|
|
1029
|
+
</Example>,
|
|
1030
|
+
'Invalid with form alert': props =>
|
|
1031
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n Alert,\n Form,\n FormAlert,\n FormGroup,\n TextInput,\n HelperText,\n HelperTextItem,\n FormHelperText\n} from '@patternfly/react-core';\nimport RhUiErrorFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-error-fill-icon';\n\nexport const FormInvalidWithAlert: React.FunctionComponent = () => {\n type validate = 'success' | 'warning' | 'error' | 'default';\n\n const [age, setAge] = useState('Five');\n const [validated, setValidated] = useState<validate>('error');\n\n const handleAgeChange = (_event, age: string) => {\n setAge(age);\n if (age === '') {\n setValidated('default');\n } else if (/^\\d+$/.test(age)) {\n setValidated('success');\n } else {\n setValidated('error');\n }\n };\n\n return (\n <Form>\n {validated === 'error' && (\n <FormAlert>\n <Alert variant=\"danger\" title=\"Fill out all required fields before continuing.\" aria-live=\"polite\" isInline />\n </FormAlert>\n )}\n <FormGroup label=\"Age\" type=\"number\" fieldId=\"age-2\">\n <TextInput\n validated={validated}\n value={age}\n id=\"age-2\"\n aria-describedby=\"age-2-helper\"\n onChange={handleAgeChange}\n />\n {validated !== 'success' && (\n <FormHelperText>\n <HelperText>\n <HelperTextItem icon={<RhUiErrorFillIcon />} variant={validated}>\n {validated === 'error' ? 'Must be a number' : 'Please enter your age'}\n </HelperTextItem>\n </HelperText>\n </FormHelperText>\n )}\n </FormGroup>\n </Form>\n );\n};\n","title":"Invalid with form alert","lang":"ts","className":""}}>
|
|
1032
|
+
|
|
1033
|
+
</Example>,
|
|
1034
|
+
'Validated': props =>
|
|
1035
|
+
<Example {...pageData} {...props} {...{"code":"import { useEffect, useState } from 'react';\nimport { Form, FormGroup, FormHelperText, HelperText, HelperTextItem, TextInput } from '@patternfly/react-core';\nimport RhUiErrorFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-error-fill-icon';\n\nexport const FormValidated: React.FunctionComponent = () => {\n type validate = 'success' | 'warning' | 'error' | 'default';\n\n const [age, setAge] = useState('Five');\n const [validated, setValidated] = useState<validate>('default');\n const [helperText, setHelperText] = useState('Enter your age to continue');\n\n const handleAgeChange = (_event, age: string) => {\n setAge(age);\n setValidated('default');\n setHelperText('Validating...');\n };\n\n // useEffect is used to simulate a server call to validate the age 2000ms after the user has entered a value, preventing calling the server on every keystroke\n useEffect(() => {\n const timer = setTimeout(() => {\n if (/^\\d+$/.test(age)) {\n if (parseInt(age) >= 21) {\n setValidated('success');\n setHelperText('Enjoy your stay');\n } else {\n setValidated('warning');\n setHelperText('You must be at least 21 years old to continue');\n }\n } else {\n setValidated('error');\n setHelperText('Must be a number');\n }\n }, 2000);\n\n return () => clearTimeout(timer);\n }, [age]);\n\n return (\n <Form>\n <FormGroup label=\"Age\" type=\"number\" fieldId=\"age-3\">\n <TextInput\n validated={validated}\n value={age}\n id=\"age-3\"\n aria-describedby=\"age-3-helper\"\n onChange={handleAgeChange}\n />\n <FormHelperText>\n <HelperText>\n <HelperTextItem variant={validated} {...(validated === 'error' && { icon: <RhUiErrorFillIcon /> })}>\n {helperText}\n </HelperTextItem>\n </HelperText>\n </FormHelperText>\n </FormGroup>\n </Form>\n );\n};\n","title":"Validated","lang":"ts","className":""}}>
|
|
1036
|
+
|
|
1037
|
+
</Example>,
|
|
1038
|
+
'Horizontal stacked no padding top': props =>
|
|
1039
|
+
<Example {...pageData} {...props} {...{"code":"import { Form, FormGroup, Checkbox } from '@patternfly/react-core';\n\nexport const FormHorizontalStacked: React.FunctionComponent = () => (\n <Form isHorizontal>\n <FormGroup role=\"group\" label=\"Label\" hasNoPaddingTop fieldId=\"horizontal-form-stacked-options\" isStack>\n <Checkbox label=\"option 1\" id=\"option-01\" />\n <Checkbox label=\"option 2\" id=\"option-02\" />\n </FormGroup>\n </Form>\n);\n","title":"Horizontal stacked no padding top","lang":"ts","className":""}}>
|
|
1040
|
+
|
|
1041
|
+
</Example>,
|
|
1042
|
+
'Horizontal stacked helper text on top': props =>
|
|
1043
|
+
<Example {...pageData} {...props} {...{"code":"import { Form, FormGroup, Checkbox, HelperText, HelperTextItem, FormHelperText } from '@patternfly/react-core';\n\nexport const FormHorizontalFormHelperText: React.FunctionComponent = () => (\n <Form isHorizontal>\n <FormGroup label=\"Label\" hasNoPaddingTop isStack fieldId=\"horizontal-form-helper-options\" role=\"group\">\n <FormHelperText>\n <HelperText>\n <HelperTextItem>Select all that apply:</HelperTextItem>\n </HelperText>\n </FormHelperText>\n <Checkbox label=\"Option 1\" id=\"option-03\" />\n <Checkbox label=\"Option 2\" id=\"option-04\" />\n </FormGroup>\n </Form>\n);\n","title":"Horizontal stacked helper text on top","lang":"ts","className":""}}>
|
|
1044
|
+
|
|
1045
|
+
</Example>,
|
|
1046
|
+
'Form group with additional label info': props =>
|
|
1047
|
+
<Example {...pageData} {...props} {...{"code":"import { useRef, useState } from 'react';\nimport {\n Form,\n FormGroup,\n TextInput,\n Popover,\n HelperText,\n HelperTextItem,\n FormHelperText,\n FormGroupLabelHelp\n} from '@patternfly/react-core';\n\nexport const FormGroupLabelInfo: React.FunctionComponent = () => {\n const [name, setName] = useState('');\n const labelHelpRef = useRef(null);\n\n const handleNameChange = (_event, name: string) => {\n setName(name);\n };\n\n return (\n <Form>\n <FormGroup\n label=\"Full name\"\n labelInfo=\"Additional label info\"\n labelHelp={\n <Popover\n triggerRef={labelHelpRef}\n headerContent={\n <div>\n The{' '}\n <a href=\"https://schema.org/name\" target=\"_blank\" rel=\"noreferrer\">\n name\n </a>{' '}\n of a{' '}\n <a href=\"https://schema.org/Person\" target=\"_blank\" rel=\"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=\"noreferrer\">\n givenName\n </a>{' '}\n and{' '}\n <a href=\"https://schema.org/familyName\" target=\"_blank\" rel=\"noreferrer\">\n familyName\n </a>\n .\n </div>\n }\n >\n <FormGroupLabelHelp ref={labelHelpRef} aria-label=\"More info for name field\" />\n </Popover>\n }\n isRequired\n fieldId=\"form-group-label-info\"\n >\n <TextInput\n isRequired\n type=\"text\"\n id=\"form-group-label-info\"\n name=\"form-group-label-info\"\n aria-describedby=\"form-group-label-info-helper\"\n value={name}\n onChange={handleNameChange}\n />\n <FormHelperText>\n <HelperText>\n <HelperTextItem>Include your middle name if you have one.</HelperTextItem>\n </HelperText>\n </FormHelperText>\n </FormGroup>\n </Form>\n );\n};\n","title":"Form group with additional label info","lang":"ts","className":""}}>
|
|
1048
|
+
|
|
1049
|
+
</Example>,
|
|
1050
|
+
'Form Sections': props =>
|
|
1051
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { Form, FormGroup, FormSection, TextInput } from '@patternfly/react-core';\n\nexport const FormSections: React.FunctionComponent = () => {\n const [input1, setInput1] = useState('');\n const [input2, setInput2] = useState('');\n\n const handleInputChange1 = (_event, input1: string) => {\n setInput1(input1);\n };\n\n const handleInputChange2 = (_event, input2: string) => {\n setInput2(input2);\n };\n\n return (\n <Form>\n <FormSection>\n <FormGroup label=\"Form section 1 input\" isRequired fieldId=\"simple-form-section-1-input\">\n <TextInput\n isRequired\n type=\"text\"\n id=\"simple-form-section-1-input\"\n name=\"simple-form-section-1-input\"\n value={input1}\n onChange={handleInputChange1}\n />\n </FormGroup>\n </FormSection>\n <FormSection title=\"Form section 2 (optional title)\" titleElement=\"h2\">\n <FormGroup label=\"Form section 2 input\" isRequired fieldId=\"simple-form-section-2-input\">\n <TextInput\n isRequired\n type=\"text\"\n id=\"simple-form-section-2-input\"\n name=\"simple-form-section-2-input\"\n value={input2}\n onChange={handleInputChange2}\n />\n </FormGroup>\n </FormSection>\n </Form>\n );\n};\n","title":"Form Sections","lang":"ts","className":""}}>
|
|
1052
|
+
|
|
1053
|
+
</Example>,
|
|
1054
|
+
'Grid form': props =>
|
|
1055
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n Form,\n FormGroup,\n TextInput,\n Grid,\n GridItem,\n HelperText,\n HelperTextItem,\n FormHelperText\n} from '@patternfly/react-core';\n\nexport const FormGrid: React.FunctionComponent = () => {\n const [name, setName] = useState('');\n const [email, setEmail] = useState('');\n const [phone, setPhone] = useState('');\n\n const handleNameChange = (_event, name: string) => {\n setName(name);\n };\n\n const handleEmailChange = (_event, email: string) => {\n setEmail(email);\n };\n\n const handlePhoneChange = (_event, phone: string) => {\n setPhone(phone);\n };\n\n return (\n <Form>\n <Grid hasGutter md={6}>\n <GridItem span={12}>\n <FormGroup label=\"Full name\" isRequired fieldId=\"grid-form-name-01\">\n <TextInput\n isRequired\n type=\"text\"\n id=\"grid-form-name-01\"\n name=\"grid-form-name-01\"\n aria-describedby=\"grid-form-name-01-helper\"\n value={name}\n onChange={handleNameChange}\n />\n <FormHelperText>\n <HelperText>\n <HelperTextItem>Include your middle name if you have one.</HelperTextItem>\n </HelperText>\n </FormHelperText>\n </FormGroup>\n </GridItem>\n <FormGroup label=\"Email\" isRequired fieldId=\"grid-form-email-01\">\n <TextInput\n isRequired\n type=\"email\"\n id=\"grid-form-email-01\"\n name=\"grid-form-email-01\"\n value={email}\n onChange={handleEmailChange}\n />\n </FormGroup>\n <FormGroup label=\"Phone number\" isRequired fieldId=\"grid-form-number-01\">\n <TextInput\n isRequired\n type=\"tel\"\n id=\"grid-form-number-01\"\n placeholder=\"555-555-5555\"\n name=\"grid-form-number-01\"\n value={phone}\n onChange={handlePhoneChange}\n />\n </FormGroup>\n </Grid>\n </Form>\n );\n};\n","title":"Grid form","lang":"ts","className":""}}>
|
|
1056
|
+
|
|
1057
|
+
</Example>,
|
|
1058
|
+
'Field Groups': props =>
|
|
1059
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n Form,\n FormGroup,\n FormFieldGroup,\n FormFieldGroupExpandable,\n FormFieldGroupHeader,\n TextInput,\n Button\n} from '@patternfly/react-core';\nimport TrashIcon from '@patternfly/react-icons/dist/esm/icons/trash-icon';\n\nexport const FormFieldGroups: React.FunctionComponent = () => {\n const initialValues = {\n '0-label1': '',\n '0-label2': '',\n '1-expanded-group1-label1': '',\n '1-expanded-group1-label2': '',\n '1-expanded-group2-label1': '',\n '1-expanded-group2-label2': '',\n '1-expanded-group3-label1': '',\n '1-expanded-group3-label2': '',\n '1-group1-label1': '',\n '1-group1-label2': '',\n '2-label1': '',\n '2-label2': '',\n '3-label1': '',\n '3-label2': '',\n '3-nonexpand-group1-label1': '',\n '3-nonexpand-group1-label2': '',\n '3-nonexpand-group2-label1': '',\n '3-nonexpand-group2-label2': '',\n '4-nonexpand-label1': '',\n '4-nonexpand-label2': '',\n '0-label3': '',\n '0-label4': ''\n };\n\n const [inputValues, setInputValues] = useState(initialValues);\n\n const handleChange = (event, value: string) => {\n const { name } = event.currentTarget;\n setInputValues({ ...inputValues, [name]: value });\n };\n\n return (\n <Form>\n <FormGroup label=\"Label 1\" isRequired fieldId=\"0-label1\">\n <TextInput isRequired id=\"0-label1\" name=\"0-label1\" value={inputValues['0-label1']} onChange={handleChange} />\n </FormGroup>\n <FormGroup label=\"Label 2\" isRequired fieldId=\"0-label2\">\n <TextInput isRequired id=\"0-label2\" name=\"0-label2\" value={inputValues['0-label2']} onChange={handleChange} />\n </FormGroup>\n <FormFieldGroupExpandable\n hasAnimations\n isExpanded\n toggleAriaLabel=\"Details\"\n header={\n <FormFieldGroupHeader\n titleText={{ text: 'Field group 1', id: 'field-group1-titleText-id' }}\n titleDescription=\"Field group 1 description text.\"\n actions={\n <>\n <Button variant=\"link\">Delete all</Button> <Button variant=\"secondary\">Add parameter</Button>\n </>\n }\n />\n }\n >\n <FormFieldGroupExpandable\n hasAnimations\n isExpanded\n toggleAriaLabel=\"Details\"\n header={\n <FormFieldGroupHeader\n titleText={{ text: 'Nested field group 1', id: 'nested-field-group1-titleText-id' }}\n titleDescription=\"Nested field group 1 description text.\"\n actions={<Button variant=\"plain\" aria-label=\"Remove\" icon={<TrashIcon />} />}\n />\n }\n >\n <FormGroup label=\"Label 1\" isRequired fieldId=\"1-expanded-group1-label1\">\n <TextInput\n isRequired\n id=\"1-expanded-group1-label1\"\n name=\"1-expanded-group1-label1\"\n value={inputValues['1-expanded-group1-label1']}\n onChange={handleChange}\n />\n </FormGroup>\n <FormGroup label=\"Label 2\" isRequired fieldId=\"1-expanded-group1-label2\">\n <TextInput\n isRequired\n id=\"1-expanded-group1-label2\"\n name=\"1-expanded-group1-label2\"\n value={inputValues['1-expanded-group1-label2']}\n onChange={handleChange}\n />\n </FormGroup>\n </FormFieldGroupExpandable>\n <FormFieldGroupExpandable\n hasAnimations\n toggleAriaLabel=\"Details\"\n header={\n <FormFieldGroupHeader\n titleText={{ text: 'Nested field group 2', id: 'nested-field-group2-titleText-id' }}\n actions={<Button variant=\"plain\" aria-label=\"Remove\" icon={<TrashIcon />} />}\n />\n }\n >\n <FormGroup label=\"Label 1\" isRequired fieldId=\"1-expanded-group2-label1\">\n <TextInput\n isRequired\n id=\"1-expanded-group2-label1\"\n name=\"1-expanded-group2-label1\"\n value={inputValues['1-expanded-group2-label1']}\n onChange={handleChange}\n />\n </FormGroup>\n <FormGroup label=\"Label 2\" isRequired fieldId=\"1-expanded-group2-label2\">\n <TextInput\n isRequired\n id=\"1-expanded-group2-label2\"\n name=\"1-expanded-group2-label2\"\n value={inputValues['1-expanded-group2-label2']}\n onChange={handleChange}\n />\n </FormGroup>\n </FormFieldGroupExpandable>\n <FormFieldGroupExpandable\n hasAnimations\n toggleAriaLabel=\"Details\"\n header={\n <FormFieldGroupHeader\n titleText={{ text: 'Nested field group 3', id: 'nested-field-group3-titleText-id' }}\n titleDescription=\"Field group 3 description text.\"\n actions={<Button variant=\"plain\" aria-label=\"Remove\" icon={<TrashIcon />} />}\n />\n }\n >\n <FormGroup label=\"Label 1\" isRequired fieldId=\"1-expanded-group3-label1\">\n <TextInput\n isRequired\n id=\"1-expanded-group3-label1\"\n name=\"1-expanded-group3-label1\"\n value={inputValues['1-expanded-group3-label1']}\n onChange={handleChange}\n />\n </FormGroup>\n <FormGroup label=\"Label 2\" isRequired fieldId=\"1-expanded-group3-label2\">\n <TextInput\n isRequired\n id=\"1-expanded-group3-label2\"\n name=\"1-expanded-group3-label2\"\n value={inputValues['1-expanded-group3-label2']}\n onChange={handleChange}\n />\n </FormGroup>\n </FormFieldGroupExpandable>\n <FormGroup label=\"Label 1\" isRequired fieldId=\"1-group1-label1\">\n <TextInput\n isRequired\n id=\"1-group1-label1\"\n name=\"1-group1-label1\"\n value={inputValues['1-group1-label1']}\n onChange={handleChange}\n />\n </FormGroup>\n <FormGroup label=\"Label 2\" isRequired fieldId=\"1-group1-label2\">\n <TextInput\n isRequired\n id=\"1-group1-label2\"\n name=\"1-group1-label2\"\n value={inputValues['1-group1-label2']}\n onChange={handleChange}\n />\n </FormGroup>\n </FormFieldGroupExpandable>\n <FormFieldGroupExpandable\n hasAnimations\n toggleAriaLabel=\"Details\"\n header={\n <FormFieldGroupHeader\n titleText={{ text: 'Field group 2', id: 'field-group2-titleText-id' }}\n titleDescription=\"Field group 2 description text.\"\n actions={\n <>\n <Button variant=\"link\">Delete all</Button> <Button variant=\"secondary\">Add parameter</Button>\n </>\n }\n />\n }\n >\n <FormGroup label=\"Label 1\" isRequired fieldId=\"2-label1\">\n <TextInput isRequired id=\"2-label1\" name=\"2-label1\" value={inputValues['2-label1']} onChange={handleChange} />\n </FormGroup>\n <FormGroup label=\"Label 2\" isRequired fieldId=\"2-label2\">\n <TextInput isRequired id=\"2-label2\" name=\"2-label2\" value={inputValues['2-label2']} onChange={handleChange} />\n </FormGroup>\n </FormFieldGroupExpandable>\n <FormFieldGroupExpandable\n hasAnimations\n isExpanded\n toggleAriaLabel=\"Details\"\n header={\n <FormFieldGroupHeader\n titleText={{ text: 'Field group 3', id: 'field-group3-titleText-id' }}\n titleDescription=\"Field group 3 description text.\"\n />\n }\n >\n <FormGroup label=\"Label 1\" isRequired fieldId=\"3-label1\">\n <TextInput isRequired id=\"3-label1\" name=\"3-label1\" value={inputValues['3-label1']} onChange={handleChange} />\n </FormGroup>\n <FormGroup label=\"Label 2\" isRequired fieldId=\"3-label2\">\n <TextInput isRequired id=\"3-label2\" name=\"3-label2\" value={inputValues['3-label2']} onChange={handleChange} />\n </FormGroup>\n <FormFieldGroup\n header={\n <FormFieldGroupHeader\n titleText={{\n text: 'Nested field group 1 (non-expandable)',\n id: 'nested-field-group1-non-expandable-titleText-id'\n }}\n />\n }\n >\n <FormGroup label=\"Label 1\" isRequired fieldId=\"3-nonexpand-group1-label1\">\n <TextInput\n isRequired\n id=\"3-nonexpand-group1-label1\"\n name=\"3-nonexpand-group1-label1\"\n value={inputValues['3-nonexpand-group1-label1']}\n onChange={handleChange}\n />\n </FormGroup>\n <FormGroup label=\"Label 2\" isRequired fieldId=\"3-nonexpand-group1-label2\">\n <TextInput\n isRequired\n id=\"3-nonexpand-group1-label2\"\n name=\"3-nonexpand-group1-label2\"\n value={inputValues['3-nonexpand-group1-label2']}\n onChange={handleChange}\n />\n </FormGroup>\n </FormFieldGroup>\n <FormFieldGroup\n header={\n <FormFieldGroupHeader\n titleText={{\n text: 'Nested field group 2 (non-expandable)',\n id: 'nested-field-group2-non-expandable-titleText-id'\n }}\n titleDescription=\"Field group 2 description text.\"\n />\n }\n >\n <FormGroup label=\"Label 1\" isRequired fieldId=\"3-nonexpand-group2-label1\">\n <TextInput\n isRequired\n id=\"3-nonexpand-group2-label1\"\n name=\"3-nonexpand-group2-label1\"\n value={inputValues['3-nonexpand-group2-label1']}\n onChange={handleChange}\n />\n </FormGroup>\n <FormGroup label=\"Label 2\" isRequired fieldId=\"3-nonexpand-group2-label2\">\n <TextInput\n isRequired\n id=\"3-nonexpand-group2-label2\"\n name=\"3-nonexpand-group2-label2\"\n value={inputValues['3-nonexpand-group2-label2']}\n onChange={handleChange}\n />\n </FormGroup>\n </FormFieldGroup>\n </FormFieldGroupExpandable>\n <FormFieldGroup\n header={\n <FormFieldGroupHeader\n titleText={{ text: 'Field group 4 (non-expandable)', id: 'field-group4-non-expandable-titleText-id' }}\n titleDescription=\"Field group 4 description text fdgsdg.\"\n actions={\n <>\n <Button variant=\"link\">Delete all</Button> <Button variant=\"secondary\">Add parameter</Button>\n </>\n }\n />\n }\n >\n <FormGroup label=\"Label 1\" isRequired fieldId=\"4-nonexpand-label1\">\n <TextInput\n isRequired\n id=\"4-nonexpand-label1\"\n name=\"4-nonexpand-label1\"\n value={inputValues['4-nonexpand-label1']}\n onChange={handleChange}\n />\n </FormGroup>\n <FormGroup label=\"Label 2\" isRequired fieldId=\"4-nonexpand-label2\">\n <TextInput\n isRequired\n id=\"4-nonexpand-label2\"\n name=\"4-nonexpand-label2\"\n value={inputValues['4-nonexpand-label2']}\n onChange={handleChange}\n />\n </FormGroup>\n </FormFieldGroup>\n <FormGroup label=\"Label 3\" isRequired fieldId=\"0-label3\">\n <TextInput isRequired id=\"0-label3\" name=\"0-label3\" value={inputValues['0-label3']} onChange={handleChange} />\n </FormGroup>\n <FormGroup label=\"Label 4\" isRequired fieldId=\"0-label4\">\n <TextInput isRequired id=\"0-label4\" name=\"0-label4\" value={inputValues['0-label4']} onChange={handleChange} />\n </FormGroup>\n </Form>\n );\n};\n","title":"Field Groups","lang":"ts","className":""}}>
|
|
1060
|
+
|
|
1061
|
+
</Example>,
|
|
1062
|
+
'Form state': props =>
|
|
1063
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n ActionGroup,\n Button,\n ButtonType,\n ButtonVariant,\n Divider,\n Form,\n FormContextProvider,\n FormGroup,\n FormHelperText,\n HelperText,\n HelperTextItem,\n MenuToggle,\n Select,\n SelectList,\n SelectOption,\n TextArea,\n TextInput\n} from '@patternfly/react-core';\nimport RhUiErrorFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-error-fill-icon';\n\nexport const FormState = () => {\n const [isSelectOpen, setIsSelectOpen] = useState(false);\n const [formStateExpanded, setFormStateExpanded] = useState(false);\n\n return (\n <FormContextProvider initialValues={{ 'select-id': 'Option 1' }}>\n {({ setValue, getValue, setError, values, errors }) => (\n <Form>\n <FormGroup label=\"Input value\" fieldId=\"input-id\" isRequired>\n <TextInput\n id=\"input-id\"\n onChange={(_event, value) => {\n setValue('input-id', value);\n setError('input-id', undefined);\n }}\n value={getValue('input-id')}\n validated={errors['input-id'] ? 'error' : 'default'}\n />\n <FormHelperText>\n <HelperText>\n <HelperTextItem\n variant={errors['input-id'] ? 'error' : 'default'}\n {...(errors['input-id'] && { icon: <RhUiErrorFillIcon /> })}\n >\n {errors['input-id']}\n </HelperTextItem>\n </HelperText>\n </FormHelperText>\n </FormGroup>\n\n <TextArea\n id=\"textarea-id\"\n aria-label=\"Form state TextArea\"\n onChange={(_event, value) => setValue('textarea-id', value)}\n value={getValue('textarea-id')}\n />\n\n <Select\n id=\"select-id\"\n selected={getValue('select-id')}\n isOpen={isSelectOpen}\n toggle={(toggleRef) => (\n <MenuToggle\n ref={toggleRef}\n onClick={(isOpen) => setIsSelectOpen(isOpen)}\n isExpanded={isSelectOpen}\n style={\n {\n width: '200px'\n } as React.CSSProperties\n }\n >\n {getValue('select-id')}\n </MenuToggle>\n )}\n onOpenChange={(isOpen) => setIsSelectOpen(isOpen)}\n onSelect={(_, value) => {\n setValue('select-id', value as string);\n setIsSelectOpen(false);\n }}\n >\n <SelectList>\n <SelectOption value=\"Option 1\">Option 1</SelectOption>\n <SelectOption value=\"Option 2\">Option 2</SelectOption>\n <SelectOption value=\"Option 3\">Option 3</SelectOption>\n </SelectList>\n </Select>\n\n <ActionGroup>\n <Button\n type={ButtonType.submit}\n onClick={(e) => {\n e.preventDefault();\n\n if (!values['input-id']) {\n setError('input-id', 'Input value is required.');\n } else {\n alert(`Form submitted with: \\n ${JSON.stringify(values)}`);\n }\n }}\n >\n Submit\n </Button>\n <Button variant={ButtonVariant.link} onClick={() => setFormStateExpanded((prevExpanded) => !prevExpanded)}>\n {`${formStateExpanded ? 'Hide' : 'Show'} form state`}\n </Button>\n </ActionGroup>\n {formStateExpanded && (\n <>\n <Divider />\n <pre>{JSON.stringify({ values, errors }, null, 2)}</pre>\n </>\n )}\n </Form>\n )}\n </FormContextProvider>\n );\n};\n","title":"Form state","lang":"ts","className":""}}>
|
|
1064
|
+
|
|
1065
|
+
</Example>
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
const Component = () => (
|
|
1069
|
+
<React.Fragment>
|
|
1070
|
+
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
1071
|
+
{`Examples`}
|
|
1072
|
+
</AutoLinkHeader>
|
|
1073
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
1074
|
+
{`When using helper text inside a `}
|
|
1075
|
+
<code {...{"className":"ws-code "}}>
|
|
1076
|
+
{`FormGroup`}
|
|
1077
|
+
</code>
|
|
1078
|
+
{`, the `}
|
|
1079
|
+
<code {...{"className":"ws-code "}}>
|
|
1080
|
+
{`HelperText`}
|
|
1081
|
+
</code>
|
|
1082
|
+
{` component should be wrapped with the `}
|
|
1083
|
+
<code {...{"className":"ws-code "}}>
|
|
1084
|
+
{`FormHelperText`}
|
|
1085
|
+
</code>
|
|
1086
|
+
{` component to provide additional spacing.`}
|
|
1087
|
+
</p>
|
|
1088
|
+
{React.createElement(pageData.examples["Basic"])}
|
|
1089
|
+
{React.createElement(pageData.examples["Horizontal"])}
|
|
1090
|
+
{React.createElement(pageData.examples["Limit width"])}
|
|
1091
|
+
{React.createElement(pageData.examples["Invalid"])}
|
|
1092
|
+
{React.createElement(pageData.examples["Invalid with form alert"])}
|
|
1093
|
+
{React.createElement(pageData.examples["Validated"])}
|
|
1094
|
+
{React.createElement(pageData.examples["Horizontal stacked no padding top"])}
|
|
1095
|
+
{React.createElement(pageData.examples["Horizontal stacked helper text on top"])}
|
|
1096
|
+
{React.createElement(pageData.examples["Form group with additional label info"])}
|
|
1097
|
+
{React.createElement(pageData.examples["Form Sections"])}
|
|
1098
|
+
{React.createElement(pageData.examples["Grid form"])}
|
|
1099
|
+
{React.createElement(pageData.examples["Field Groups"])}
|
|
1100
|
+
{React.createElement(pageData.examples["Form state"])}
|
|
1101
|
+
</React.Fragment>
|
|
1102
|
+
);
|
|
1103
|
+
Component.displayName = 'ComponentsFormsFormReactDocs';
|
|
1104
|
+
Component.pageData = pageData;
|
|
1105
|
+
|
|
1106
|
+
export default Component;
|