@patternfly/react-docs 7.6.0-prerelease.7 → 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/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,208 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
const pageData = {
|
|
5
|
+
"id": "Form select",
|
|
6
|
+
"section": "components",
|
|
7
|
+
"subsection": "forms",
|
|
8
|
+
"deprecated": false,
|
|
9
|
+
"template": false,
|
|
10
|
+
"beta": false,
|
|
11
|
+
"demo": false,
|
|
12
|
+
"newImplementationLink": false,
|
|
13
|
+
"source": "react",
|
|
14
|
+
"tabName": null,
|
|
15
|
+
"slug": "/components/forms/form-select/react",
|
|
16
|
+
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/FormSelect/examples/FormSelect.md",
|
|
17
|
+
"relPath": "packages/react-core/src/components/FormSelect/examples/FormSelect.md",
|
|
18
|
+
"propComponents": [
|
|
19
|
+
{
|
|
20
|
+
"name": "FormSelect",
|
|
21
|
+
"description": "",
|
|
22
|
+
"props": [
|
|
23
|
+
{
|
|
24
|
+
"name": "aria-label",
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Custom flag to show that the FormSelect requires an associated id or aria-label."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "children",
|
|
30
|
+
"type": "React.ReactNode",
|
|
31
|
+
"description": "content rendered inside the FormSelect",
|
|
32
|
+
"required": true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "className",
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "additional classes added to the FormSelect control",
|
|
38
|
+
"defaultValue": "''"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "isDisabled",
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"description": "Flag indicating the FormSelect is disabled",
|
|
44
|
+
"defaultValue": "false"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "isRequired",
|
|
48
|
+
"type": "boolean",
|
|
49
|
+
"description": "Sets the FormSelect required.",
|
|
50
|
+
"defaultValue": "false"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "onBlur",
|
|
54
|
+
"type": "(event: React.FormEvent<HTMLSelectElement>) => void",
|
|
55
|
+
"description": "Optional callback for updating when selection loses focus",
|
|
56
|
+
"defaultValue": "(): any => undefined"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "onChange",
|
|
60
|
+
"type": "(event: React.FormEvent<HTMLSelectElement>, value: string) => void",
|
|
61
|
+
"description": "Optional callback for updating when selection changes",
|
|
62
|
+
"defaultValue": "(): any => undefined"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "onFocus",
|
|
66
|
+
"type": "(event: React.FormEvent<HTMLSelectElement>) => void",
|
|
67
|
+
"description": "Optional callback for updating when selection gets focus",
|
|
68
|
+
"defaultValue": "(): any => undefined"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "ouiaId",
|
|
72
|
+
"type": "number | string",
|
|
73
|
+
"description": "Value to overwrite the randomly generated data-ouia-component-id."
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "ouiaSafe",
|
|
77
|
+
"type": "boolean",
|
|
78
|
+
"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.",
|
|
79
|
+
"defaultValue": "true"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "validated",
|
|
83
|
+
"type": "'success' | 'warning' | 'error' | 'default'",
|
|
84
|
+
"description": "Value to indicate if the select is modified to show that validation state.\nIf set to success, select will be modified to indicate valid state.\nIf set to error, select will be modified to indicate error state.",
|
|
85
|
+
"defaultValue": "'default'"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "value",
|
|
89
|
+
"type": "any",
|
|
90
|
+
"description": "value of selected option",
|
|
91
|
+
"defaultValue": "''"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "FormSelectOption",
|
|
97
|
+
"description": "",
|
|
98
|
+
"props": [
|
|
99
|
+
{
|
|
100
|
+
"name": "className",
|
|
101
|
+
"type": "string",
|
|
102
|
+
"description": "additional classes added to the Select Option",
|
|
103
|
+
"defaultValue": "''"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "isDisabled",
|
|
107
|
+
"type": "boolean",
|
|
108
|
+
"description": "flag indicating if the option is disabled",
|
|
109
|
+
"defaultValue": "false"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "isPlaceholder",
|
|
113
|
+
"type": "boolean",
|
|
114
|
+
"description": "flag indicating if option will have placeholder styling applied when selected *",
|
|
115
|
+
"defaultValue": "false"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "label",
|
|
119
|
+
"type": "string",
|
|
120
|
+
"description": "the label for the option",
|
|
121
|
+
"required": true
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "value",
|
|
125
|
+
"type": "any",
|
|
126
|
+
"description": "the value for the option",
|
|
127
|
+
"defaultValue": "''"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "FormSelectOptionGroup",
|
|
133
|
+
"description": "",
|
|
134
|
+
"props": [
|
|
135
|
+
{
|
|
136
|
+
"name": "children",
|
|
137
|
+
"type": "React.ReactNode",
|
|
138
|
+
"description": "content rendered inside the Select Option Group",
|
|
139
|
+
"defaultValue": "null"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "className",
|
|
143
|
+
"type": "string",
|
|
144
|
+
"description": "additional classes added to the Select Option",
|
|
145
|
+
"defaultValue": "''"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"name": "isDisabled",
|
|
149
|
+
"type": "boolean",
|
|
150
|
+
"description": "flag indicating if the Option Group is disabled",
|
|
151
|
+
"defaultValue": "false"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "label",
|
|
155
|
+
"type": "string",
|
|
156
|
+
"description": "the label for the option",
|
|
157
|
+
"required": true
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"cssPrefix": [
|
|
163
|
+
"pf-v6-c-form-control"
|
|
164
|
+
],
|
|
165
|
+
"examples": [
|
|
166
|
+
"Basic",
|
|
167
|
+
"Validated",
|
|
168
|
+
"Disabled",
|
|
169
|
+
"Grouped"
|
|
170
|
+
]
|
|
171
|
+
};
|
|
172
|
+
pageData.liveContext = {
|
|
173
|
+
useState
|
|
174
|
+
};
|
|
175
|
+
pageData.examples = {
|
|
176
|
+
'Basic': props =>
|
|
177
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { FormSelect, FormSelectOption } from '@patternfly/react-core';\n\nexport const FormSelectBasic: React.FunctionComponent = () => {\n const [formSelectValue, setFormSelectValue] = useState('mrs');\n\n const onChange = (_event: React.FormEvent<HTMLSelectElement>, value: string) => {\n setFormSelectValue(value);\n };\n\n const options = [\n { value: 'please choose', label: 'Select one', disabled: true },\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 <FormSelect value={formSelectValue} onChange={onChange} aria-label=\"FormSelect Input\" ouiaId=\"BasicFormSelect\">\n {options.map((option, index) => (\n <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.label} />\n ))}\n </FormSelect>\n );\n};\n","title":"Basic","lang":"ts","className":""}}>
|
|
178
|
+
|
|
179
|
+
</Example>,
|
|
180
|
+
'Validated': props =>
|
|
181
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport {\n Form,\n FormGroup,\n FormHelperText,\n FormSelect,\n FormSelectOption,\n HelperText,\n HelperTextItem,\n ValidatedOptions\n} from '@patternfly/react-core';\n\nexport const FormSelectValidated: React.FunctionComponent = () => {\n const [formValue, setFormValue] = useState('');\n const [helperText, setHelperText] = useState('');\n const [validated, setValidated] = useState<ValidatedOptions>(ValidatedOptions.default);\n\n const simulateNetworkCall = (callback: () => void) => {\n setTimeout(callback, 2000);\n };\n\n const onChange = (_event: React.FormEvent<HTMLSelectElement>, value: string) => {\n setFormValue(value);\n setValidated(ValidatedOptions.default);\n setHelperText('Validating...');\n simulateNetworkCall(() => {\n if (value === '3') {\n setValidated(ValidatedOptions.success);\n setHelperText('You chose wisely');\n } else if (value === '') {\n setValidated(ValidatedOptions.warning);\n setHelperText('You must select a value');\n } else {\n setValidated(ValidatedOptions.error);\n setHelperText('You must chose Three (thought that was obvious)');\n }\n });\n };\n\n const options = [\n { value: '', label: 'Select a number', disabled: false, isPlaceholder: true },\n { value: '1', label: 'One', disabled: false, isPlaceholder: false },\n { value: '2', label: 'Two', disabled: false, isPlaceholder: false },\n { value: '3', label: 'Three - the only valid option', disabled: false, isPlaceholder: false }\n ];\n\n return (\n <Form>\n <FormGroup label=\"Selection:\" type=\"string\" fieldId=\"selection\">\n <FormSelect\n id=\"selection\"\n validated={validated}\n value={formValue}\n onChange={onChange}\n aria-label=\"FormSelect Input\"\n >\n {options.map((option, index) => (\n <FormSelectOption\n isDisabled={option.disabled}\n key={index}\n value={option.value}\n label={option.label}\n isPlaceholder={option.isPlaceholder}\n />\n ))}\n </FormSelect>\n <FormHelperText>\n <HelperText>\n <HelperTextItem variant={validated}>{helperText}</HelperTextItem>\n </HelperText>\n </FormHelperText>\n </FormGroup>\n </Form>\n );\n};\n","title":"Validated","lang":"ts","className":""}}>
|
|
182
|
+
|
|
183
|
+
</Example>,
|
|
184
|
+
'Disabled': props =>
|
|
185
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { FormSelect, FormSelectOption } from '@patternfly/react-core';\n\nexport const FormSelectDisabled: React.FunctionComponent = () => {\n const [formSelectValue, setFormSelectValue] = useState('mrs');\n\n const onChange = (_event: React.FormEvent<HTMLSelectElement>, value: string) => {\n setFormSelectValue(value);\n };\n\n const options = [\n { value: 'please choose', label: 'Select one', disabled: true },\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 <FormSelect value={formSelectValue} onChange={onChange} isDisabled aria-label=\"FormSelect Input\">\n {options.map((option, index) => (\n <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.label} />\n ))}\n </FormSelect>\n );\n};\n","title":"Disabled","lang":"ts","className":""}}>
|
|
186
|
+
|
|
187
|
+
</Example>,
|
|
188
|
+
'Grouped': props =>
|
|
189
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { FormSelect, FormSelectOption, FormSelectOptionGroup } from '@patternfly/react-core';\n\nexport const FormSelectGrouped: React.FunctionComponent = () => {\n const [formSelectValue, setFormSelectValue] = useState('2');\n\n const onChange = (_event: React.FormEvent<HTMLSelectElement>, value: string) => {\n setFormSelectValue(value);\n };\n\n const groups = [\n {\n groupLabel: 'Group1',\n disabled: false,\n options: [\n { value: '1', label: 'The first option', disabled: false },\n { value: '2', label: 'Second option is selected by default', disabled: false }\n ]\n },\n {\n groupLabel: 'Group2',\n disabled: false,\n options: [\n { value: '3', label: 'The third option', disabled: false },\n { value: '4', label: 'The fourth option', disabled: false }\n ]\n },\n {\n groupLabel: 'Group3',\n disabled: true,\n options: [\n { value: '5', label: 'The fifth option', disabled: false },\n { value: '6', label: 'The sixth option', disabled: false }\n ]\n }\n ];\n\n return (\n <FormSelect value={formSelectValue} onChange={onChange} aria-label=\"FormSelect Input\">\n {groups.map((group, index) => (\n <FormSelectOptionGroup isDisabled={group.disabled} key={index} label={group.groupLabel}>\n {group.options.map((option, i) => (\n <FormSelectOption isDisabled={option.disabled} key={i} value={option.value} label={option.label} />\n ))}\n </FormSelectOptionGroup>\n ))}\n </FormSelect>\n );\n};\n","title":"Grouped","lang":"ts","className":""}}>
|
|
190
|
+
|
|
191
|
+
</Example>
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const Component = () => (
|
|
195
|
+
<React.Fragment>
|
|
196
|
+
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
197
|
+
{`Examples`}
|
|
198
|
+
</AutoLinkHeader>
|
|
199
|
+
{React.createElement(pageData.examples["Basic"])}
|
|
200
|
+
{React.createElement(pageData.examples["Validated"])}
|
|
201
|
+
{React.createElement(pageData.examples["Disabled"])}
|
|
202
|
+
{React.createElement(pageData.examples["Grouped"])}
|
|
203
|
+
</React.Fragment>
|
|
204
|
+
);
|
|
205
|
+
Component.displayName = 'ComponentsFormsFormSelectReactDocs';
|
|
206
|
+
Component.pageData = pageData;
|
|
207
|
+
|
|
208
|
+
export default Component;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
import { Fragment, useState } from 'react';
|
|
4
|
+
const pageData = {
|
|
5
|
+
"id": "Radio",
|
|
6
|
+
"section": "components",
|
|
7
|
+
"subsection": "forms",
|
|
8
|
+
"deprecated": false,
|
|
9
|
+
"template": false,
|
|
10
|
+
"beta": false,
|
|
11
|
+
"demo": false,
|
|
12
|
+
"newImplementationLink": false,
|
|
13
|
+
"source": "react",
|
|
14
|
+
"tabName": null,
|
|
15
|
+
"slug": "/components/forms/radio/react",
|
|
16
|
+
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/Radio/examples/Radio.md",
|
|
17
|
+
"relPath": "packages/react-core/src/components/Radio/examples/Radio.md",
|
|
18
|
+
"propComponents": [
|
|
19
|
+
{
|
|
20
|
+
"name": "Radio",
|
|
21
|
+
"description": "",
|
|
22
|
+
"props": [
|
|
23
|
+
{
|
|
24
|
+
"name": "aria-describedby",
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Custom aria-describedby value for the radio input. If not provided and description is set, a unique ID will be generated automatically."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "aria-label",
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Aria label for the radio."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "body",
|
|
35
|
+
"type": "React.ReactNode",
|
|
36
|
+
"description": "Body of the radio."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "checked",
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"description": "Flag to show if the radio is checked."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "className",
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Additional classes added to the radio wrapper. This wrapper will be div element by default. It will be a label element if\nisLabelWrapped is true, or it can be overridden by any element specified in the component prop.",
|
|
47
|
+
"defaultValue": "''"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "component",
|
|
51
|
+
"type": "React.ElementType",
|
|
52
|
+
"description": "Sets the radio wrapper component to render. Defaults to \"div\". If set to \"label\", behaves the same as if isLabelWrapped prop was specified."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "description",
|
|
56
|
+
"type": "React.ReactNode",
|
|
57
|
+
"description": "Description text of the radio."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "id",
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "Id of the radio.",
|
|
63
|
+
"required": true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "inputClassName",
|
|
67
|
+
"type": "string",
|
|
68
|
+
"description": "Additional classes added to the radio input."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "isChecked",
|
|
72
|
+
"type": "boolean",
|
|
73
|
+
"description": "Flag to show if the radio is checked."
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "isDisabled",
|
|
77
|
+
"type": "boolean",
|
|
78
|
+
"description": "Flag to show if the radio is disabled.",
|
|
79
|
+
"defaultValue": "false"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "isLabelWrapped",
|
|
83
|
+
"type": "boolean",
|
|
84
|
+
"description": "Flag to indicate whether the radio wrapper element is a native label element for the radio input. Will not apply if a component prop (with a value other than a \"label\") is specified."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "isValid",
|
|
88
|
+
"type": "boolean",
|
|
89
|
+
"description": "Flag to show if the radio selection is valid or invalid.",
|
|
90
|
+
"defaultValue": "true"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "label",
|
|
94
|
+
"type": "React.ReactNode",
|
|
95
|
+
"description": "Label text of the radio."
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "labelPosition",
|
|
99
|
+
"type": "'start' | 'end'",
|
|
100
|
+
"description": "Sets the position of the label. Defaults to 'end' (after the radio input)."
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "name",
|
|
104
|
+
"type": "string",
|
|
105
|
+
"description": "Name for group of radios",
|
|
106
|
+
"required": true
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "onChange",
|
|
110
|
+
"type": "(event: React.FormEvent<HTMLInputElement>, checked: boolean) => void",
|
|
111
|
+
"description": "A callback for when the radio selection changes.",
|
|
112
|
+
"defaultValue": "() => {}"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "ouiaId",
|
|
116
|
+
"type": "number | string",
|
|
117
|
+
"description": "Value to overwrite the randomly generated data-ouia-component-id."
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "ouiaSafe",
|
|
121
|
+
"type": "boolean",
|
|
122
|
+
"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."
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"cssPrefix": [
|
|
128
|
+
"pf-v6-c-radio"
|
|
129
|
+
],
|
|
130
|
+
"examples": [
|
|
131
|
+
"Controlled",
|
|
132
|
+
"Uncontrolled",
|
|
133
|
+
"Reversed",
|
|
134
|
+
"Label wraps",
|
|
135
|
+
"Disabled",
|
|
136
|
+
"With description",
|
|
137
|
+
"With body",
|
|
138
|
+
"With description and body",
|
|
139
|
+
"Standalone input"
|
|
140
|
+
]
|
|
141
|
+
};
|
|
142
|
+
pageData.liveContext = {
|
|
143
|
+
Fragment,
|
|
144
|
+
useState
|
|
145
|
+
};
|
|
146
|
+
pageData.examples = {
|
|
147
|
+
'Controlled': props =>
|
|
148
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Radio } from '@patternfly/react-core';\n\nexport const RadioControlled: React.FunctionComponent = () => {\n const [check1, setCheck1] = useState(false);\n\n const handleChange = () => {\n setCheck1(true);\n };\n return (\n <Fragment>\n <Radio\n isChecked={check1}\n name=\"radio-1\"\n onChange={handleChange}\n label=\"Controlled Radio\"\n id=\"radio-controlled\"\n ></Radio>\n </Fragment>\n );\n};\n","title":"Controlled","lang":"ts","className":""}}>
|
|
149
|
+
|
|
150
|
+
</Example>,
|
|
151
|
+
'Uncontrolled': props =>
|
|
152
|
+
<Example {...pageData} {...props} {...{"code":"import { Radio } from '@patternfly/react-core';\n\nexport const RadioUncontrolled: React.FunctionComponent = () => (\n <Radio label=\"Uncontrolled radio example\" id=\"radio-uncontrolled\" name=\"radio-2\" />\n);\n","title":"Uncontrolled","lang":"ts","className":""}}>
|
|
153
|
+
|
|
154
|
+
</Example>,
|
|
155
|
+
'Reversed': props =>
|
|
156
|
+
<Example {...pageData} {...props} {...{"code":"import { Radio } from '@patternfly/react-core';\n\nexport const RadioReversed: React.FunctionComponent = () => (\n <Radio labelPosition=\"start\" label=\"Reversed radio example\" id=\"radio-reversed\" name=\"radio-3\" />\n);\n","title":"Reversed","lang":"ts","className":""}}>
|
|
157
|
+
|
|
158
|
+
</Example>,
|
|
159
|
+
'Label wraps': props =>
|
|
160
|
+
<Example {...pageData} {...props} {...{"code":"import { Radio } from '@patternfly/react-core';\n\nexport const RadioLabelWraps: React.FunctionComponent = () => (\n <Radio isLabelWrapped label=\"Label wraps input example\" id=\"radio-label-wraps-input\" name=\"radio-4\" />\n);\n","title":"Label wraps","lang":"ts","className":""}}>
|
|
161
|
+
|
|
162
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
163
|
+
{`You can expand the clickable area of a radio so that it spans wider than the radio label by adding the `}
|
|
164
|
+
|
|
165
|
+
<code {...{"className":"ws-code "}}>
|
|
166
|
+
{`isLabelWrapped`}
|
|
167
|
+
</code>
|
|
168
|
+
{` property. This allows users to select a radio by clicking the radio itself, the label, or the area between the radio and the label.`}
|
|
169
|
+
</p>
|
|
170
|
+
</Example>,
|
|
171
|
+
'Disabled': props =>
|
|
172
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment } from 'react';\nimport { Radio } from '@patternfly/react-core';\n\nexport const RadioDisabled: React.FunctionComponent = () => (\n <Fragment>\n <Radio id=\"radio-disabled\" label=\"Disabled radio example\" isDisabled name=\"radio-5\" />\n <Radio\n id=\"radio-disabled-checked\"\n defaultChecked\n label=\"Disabled and checked radio example\"\n isDisabled\n name=\"radio-6\"\n />\n </Fragment>\n);\n","title":"Disabled","lang":"ts","className":""}}>
|
|
173
|
+
|
|
174
|
+
</Example>,
|
|
175
|
+
'With description': props =>
|
|
176
|
+
<Example {...pageData} {...props} {...{"code":"import { Radio } from '@patternfly/react-core';\n\nexport const RadioWithDescription: React.FunctionComponent = () => (\n <Radio\n id=\"radio-with-description\"\n label=\"Radio with description example\"\n name=\"radio-7\"\n description=\"Single-tenant cloud service hosted and managed by Red Hat that offers high-availability enterprise-grade clusters in a virtual private cloud on AWS or GCP.\"\n />\n);\n","title":"With description","lang":"ts","className":""}}>
|
|
177
|
+
|
|
178
|
+
</Example>,
|
|
179
|
+
'With body': props =>
|
|
180
|
+
<Example {...pageData} {...props} {...{"code":"import { Radio } from '@patternfly/react-core';\n\nexport const RadioWithBody: React.FunctionComponent = () => (\n <Radio id=\"radio-with-body\" label=\"Radio with body\" name=\"radio-8\" body=\"This is where custom content goes.\" />\n);\n","title":"With body","lang":"ts","className":""}}>
|
|
181
|
+
|
|
182
|
+
</Example>,
|
|
183
|
+
'With description and body': props =>
|
|
184
|
+
<Example {...pageData} {...props} {...{"code":"import { Radio } from '@patternfly/react-core';\n\nexport const RadioWithDescriptionAndBody: React.FunctionComponent = () => (\n <Radio\n id=\"radio-description-body\"\n label=\"Radio with description and body\"\n description=\"Single-tenant cloud service hosted and managed by Red Hat that offers high-availability enterprise-grade clusters in a virtual private cloud on AWS or GCP.\"\n body=\"This is where custom content goes.\"\n name=\"radio-8\"\n />\n);\n","title":"With description and body","lang":"ts","className":""}}>
|
|
185
|
+
|
|
186
|
+
</Example>,
|
|
187
|
+
'Standalone input': props =>
|
|
188
|
+
<Example {...pageData} {...props} {...{"code":"import { Radio } from '@patternfly/react-core';\n\nexport const RadioStandaloneInput: React.FunctionComponent = () => (\n <Radio id=\"radio-standalone\" aria-label=\"Standalone input\" name=\"exampleRadioStandalone\" />\n);\n","title":"Standalone input","lang":"ts","className":""}}>
|
|
189
|
+
|
|
190
|
+
</Example>
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const Component = () => (
|
|
194
|
+
<React.Fragment>
|
|
195
|
+
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
196
|
+
{`Examples`}
|
|
197
|
+
</AutoLinkHeader>
|
|
198
|
+
{React.createElement(pageData.examples["Controlled"])}
|
|
199
|
+
{React.createElement(pageData.examples["Uncontrolled"])}
|
|
200
|
+
{React.createElement(pageData.examples["Reversed"])}
|
|
201
|
+
{React.createElement(pageData.examples["Label wraps"])}
|
|
202
|
+
{React.createElement(pageData.examples["Disabled"])}
|
|
203
|
+
{React.createElement(pageData.examples["With description"])}
|
|
204
|
+
{React.createElement(pageData.examples["With body"])}
|
|
205
|
+
{React.createElement(pageData.examples["With description and body"])}
|
|
206
|
+
{React.createElement(pageData.examples["Standalone input"])}
|
|
207
|
+
</React.Fragment>
|
|
208
|
+
);
|
|
209
|
+
Component.displayName = 'ComponentsFormsRadioReactDocs';
|
|
210
|
+
Component.pageData = pageData;
|
|
211
|
+
|
|
212
|
+
export default Component;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
import { Fragment, useRef, useState } from 'react';
|
|
4
|
+
const pageData = {
|
|
5
|
+
"id": "Text area",
|
|
6
|
+
"section": "components",
|
|
7
|
+
"subsection": "forms",
|
|
8
|
+
"deprecated": false,
|
|
9
|
+
"template": false,
|
|
10
|
+
"beta": false,
|
|
11
|
+
"demo": false,
|
|
12
|
+
"newImplementationLink": false,
|
|
13
|
+
"source": "react",
|
|
14
|
+
"tabName": null,
|
|
15
|
+
"slug": "/components/forms/text-area/react",
|
|
16
|
+
"sourceLink": "https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/TextArea/examples/TextArea.md",
|
|
17
|
+
"relPath": "packages/react-core/src/components/TextArea/examples/TextArea.md",
|
|
18
|
+
"propComponents": [
|
|
19
|
+
{
|
|
20
|
+
"name": "TextArea",
|
|
21
|
+
"description": "",
|
|
22
|
+
"props": [
|
|
23
|
+
{
|
|
24
|
+
"name": "aria-label",
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Custom flag to show that the text area requires an associated id or aria-label."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "autoResize",
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"description": "Flag to modify height based on contents."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "className",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "Additional classes added to the text area."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "isDisabled",
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"description": "Flag to show if the text area is disabled."
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "isRequired",
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"description": "Flag to show if the text area is required."
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "onChange",
|
|
50
|
+
"type": "(event: React.ChangeEvent<HTMLTextAreaElement>, value: string) => void",
|
|
51
|
+
"description": "A callback for when the text area value changes."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "readOnlyVariant",
|
|
55
|
+
"type": "'default' | 'plain'",
|
|
56
|
+
"description": "Read only variant."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "resizeOrientation",
|
|
60
|
+
"type": "'horizontal' | 'vertical' | 'both' | 'none'",
|
|
61
|
+
"description": "Sets the orientation to limit the resize to"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "validated",
|
|
65
|
+
"type": "'success' | 'warning' | 'error' | 'default'",
|
|
66
|
+
"description": "Value to indicate if the text area is modified to show that validation state.\nIf set to success, text area will be modified to indicate valid state.\nIf set to error, text area will be modified to indicate error state."
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "value",
|
|
70
|
+
"type": "string | number",
|
|
71
|
+
"description": "Value of the text area."
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"cssPrefix": [
|
|
77
|
+
"pf-v6-c-form-control"
|
|
78
|
+
],
|
|
79
|
+
"examples": [
|
|
80
|
+
"Basic",
|
|
81
|
+
"Invalid",
|
|
82
|
+
"Validated",
|
|
83
|
+
"Vertically resizable",
|
|
84
|
+
"Horizontally resizable",
|
|
85
|
+
"Not resizable",
|
|
86
|
+
"Uncontrolled",
|
|
87
|
+
"Disabled",
|
|
88
|
+
"Read only",
|
|
89
|
+
"Auto resizing"
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
pageData.liveContext = {
|
|
93
|
+
Fragment,
|
|
94
|
+
useRef,
|
|
95
|
+
useState
|
|
96
|
+
};
|
|
97
|
+
pageData.examples = {
|
|
98
|
+
'Basic': props =>
|
|
99
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TextArea } from '@patternfly/react-core';\n\nexport const TextAreaBasic: React.FunctionComponent = () => {\n const [value, setValue] = useState('');\n return <TextArea value={value} onChange={(_event, value) => setValue(value)} aria-label=\"text area example\" />;\n};\n","title":"Basic","lang":"ts","className":""}}>
|
|
100
|
+
|
|
101
|
+
</Example>,
|
|
102
|
+
'Invalid': props =>
|
|
103
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TextArea } from '@patternfly/react-core';\n\nexport const TextAreaInvalid: React.FunctionComponent = () => {\n const [value, setValue] = useState('');\n return (\n <TextArea\n value={value}\n onChange={(_event, value) => setValue(value)}\n isRequired\n validated={'error'}\n aria-label=\"invalid text area example\"\n />\n );\n};\n","title":"Invalid","lang":"ts","className":""}}>
|
|
104
|
+
|
|
105
|
+
</Example>,
|
|
106
|
+
'Validated': props =>
|
|
107
|
+
<Example {...pageData} {...props} {...{"code":"import { useRef, useState } from 'react';\nimport { Form, FormGroup, FormHelperText, HelperText, HelperTextItem, TextArea } from '@patternfly/react-core';\n\nexport const TextAreaValidated: React.FunctionComponent = () => {\n const [value, setValue] = useState('');\n const [validated, setValidated] = useState<'default' | 'error' | 'warning' | 'success' | undefined>('default');\n const [helperText, setHelperText] = useState('Share your thoughts.');\n const timerRef = useRef<number | null>(null);\n const simulateNetworkCall = (callback: Function) => {\n if (timerRef.current) {\n clearTimeout(timerRef.current);\n }\n timerRef.current = setTimeout(callback, 2000);\n };\n\n const handleTextAreaChange = (value: string) => {\n setValue(value);\n setValidated('default');\n setHelperText('Validating...');\n simulateNetworkCall(() => {\n if (value.length > 0) {\n if (value.length >= 10) {\n setValidated('success');\n setHelperText('Thanks for your comments!');\n } else {\n setValidated('error');\n setHelperText(\"You're being too brief, please enter at least 10 characters.\");\n }\n } else {\n setValidated('warning');\n setHelperText('You must have something to say');\n }\n });\n };\n return (\n <Form>\n <FormGroup label=\"Comments:\" type=\"string\" fieldId=\"selection\">\n <TextArea\n value={value}\n onChange={(_event, value) => handleTextAreaChange(value)}\n isRequired\n validated={validated}\n aria-label=\"invalid text area example\"\n />\n <FormHelperText>\n <HelperText>\n <HelperTextItem variant={validated}>{helperText}</HelperTextItem>\n </HelperText>\n </FormHelperText>\n </FormGroup>\n </Form>\n );\n};\n","title":"Validated","lang":"ts","className":""}}>
|
|
108
|
+
|
|
109
|
+
</Example>,
|
|
110
|
+
'Vertically resizable': props =>
|
|
111
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TextArea } from '@patternfly/react-core';\n\nexport const VerticalResizeTextArea: React.FunctionComponent = () => {\n const [value, setValue] = useState('');\n return (\n <TextArea\n value={value}\n onChange={(_event, value) => setValue(value)}\n resizeOrientation=\"vertical\"\n aria-label=\"text area vertical resize example\"\n />\n );\n};\n","title":"Vertically resizable","lang":"ts","className":""}}>
|
|
112
|
+
|
|
113
|
+
</Example>,
|
|
114
|
+
'Horizontally resizable': props =>
|
|
115
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TextArea } from '@patternfly/react-core';\n\nexport const TextAreaHorizontallyResizable: React.FunctionComponent = () => {\n const [value, setValue] = useState('');\n return (\n <TextArea\n value={value}\n onChange={(_event, value) => setValue(value)}\n resizeOrientation=\"horizontal\"\n aria-label=\"text area horizontal resize example\"\n />\n );\n};\n","title":"Horizontally resizable","lang":"ts","className":""}}>
|
|
116
|
+
|
|
117
|
+
</Example>,
|
|
118
|
+
'Not resizable': props =>
|
|
119
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TextArea } from '@patternfly/react-core';\n\nexport const TextAreaResizeNone: React.FunctionComponent = () => {\n const [value, setValue] = useState('');\n return (\n <TextArea\n value={value}\n onChange={(_event, value) => setValue(value)}\n resizeOrientation=\"none\"\n aria-label=\"text area resize none example\"\n />\n );\n};\n","title":"Not resizable","lang":"ts","className":""}}>
|
|
120
|
+
|
|
121
|
+
</Example>,
|
|
122
|
+
'Uncontrolled': props =>
|
|
123
|
+
<Example {...pageData} {...props} {...{"code":"import { TextArea } from '@patternfly/react-core';\n\nexport const TextAreaUncontrolled: React.FunctionComponent = () => (\n <TextArea defaultValue=\"default value\" aria-label=\"uncontrolled text area example\" />\n);\n","title":"Uncontrolled","lang":"ts","className":""}}>
|
|
124
|
+
|
|
125
|
+
</Example>,
|
|
126
|
+
'Disabled': props =>
|
|
127
|
+
<Example {...pageData} {...props} {...{"code":"import { TextArea } from '@patternfly/react-core';\n\nexport const TextAreaDisabled: React.FunctionComponent = () => (\n <TextArea aria-label=\"disabled text area example\" isDisabled />\n);\n","title":"Disabled","lang":"ts","className":""}}>
|
|
128
|
+
|
|
129
|
+
</Example>,
|
|
130
|
+
'Read only': props =>
|
|
131
|
+
<Example {...pageData} {...props} {...{"code":"import { Fragment, useState } from 'react';\nimport { Checkbox, TextArea } from '@patternfly/react-core';\n\nexport const TextAreaReadOnly: React.FunctionComponent = () => {\n const [isPlainChecked, setIsPlainChecked] = useState(false);\n\n return (\n <Fragment>\n <div style={{ marginBottom: '12px' }}>\n <Checkbox\n id=\"isPlain\"\n key=\"isPlain\"\n label=\"Plain read only variant\"\n isChecked={isPlainChecked}\n onChange={(_event, checked) => setIsPlainChecked(checked)}\n />\n </div>\n <TextArea\n aria-label=\"read only text area example\"\n value=\"read only text area example\"\n readOnlyVariant={isPlainChecked ? 'plain' : 'default'}\n />\n </Fragment>\n );\n};\n","title":"Read only","lang":"ts","className":""}}>
|
|
132
|
+
|
|
133
|
+
</Example>,
|
|
134
|
+
'Auto resizing': props =>
|
|
135
|
+
<Example {...pageData} {...props} {...{"code":"import { useState } from 'react';\nimport { TextArea } from '@patternfly/react-core';\n\nexport const TextAreaAutoResizing: React.FunctionComponent = () => {\n const [value, setValue] = useState('');\n return (\n <TextArea\n value={value}\n onChange={(_event, value) => setValue(value)}\n aria-label=\"auto resizing text area example\"\n autoResize\n />\n );\n};\n","title":"Auto resizing","lang":"ts","className":""}}>
|
|
136
|
+
|
|
137
|
+
</Example>
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const Component = () => (
|
|
141
|
+
<React.Fragment>
|
|
142
|
+
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
143
|
+
{`Examples`}
|
|
144
|
+
</AutoLinkHeader>
|
|
145
|
+
{React.createElement(pageData.examples["Basic"])}
|
|
146
|
+
{React.createElement(pageData.examples["Invalid"])}
|
|
147
|
+
{React.createElement(pageData.examples["Validated"])}
|
|
148
|
+
{React.createElement(pageData.examples["Vertically resizable"])}
|
|
149
|
+
{React.createElement(pageData.examples["Horizontally resizable"])}
|
|
150
|
+
{React.createElement(pageData.examples["Not resizable"])}
|
|
151
|
+
{React.createElement(pageData.examples["Uncontrolled"])}
|
|
152
|
+
{React.createElement(pageData.examples["Disabled"])}
|
|
153
|
+
{React.createElement(pageData.examples["Read only"])}
|
|
154
|
+
{React.createElement(pageData.examples["Auto resizing"])}
|
|
155
|
+
</React.Fragment>
|
|
156
|
+
);
|
|
157
|
+
Component.displayName = 'ComponentsFormsTextAreaReactDocs';
|
|
158
|
+
Component.pageData = pageData;
|
|
159
|
+
|
|
160
|
+
export default Component;
|