You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* As part of
inveniosoftware/react-invenio-forms#298, UI
widgets are being given a standardised common set of props (on top of
which each widget can have additional, more specific props)
* This PR changes the reference docs for custom field widgets by
splitting into the two distinct sections of "common props" and
"widget-specific props"
The following document is a reference guide for all the React UI widgets available for custom fields.
6
6
7
+
## Common props
8
+
9
+
These props are applicable to all widgets. In the reference below, only props additional to these are shown for each widget.
10
+
11
+
-**fieldPath**`String`_required_: The path to the field e.g. `cern:experiment`.
12
+
13
+
-**label**`String`_required_: The label for the element's display. This is used whenever the field should be displayed e.g. upload form, landing page etc.
14
+
15
+
-**labelIcon**`String`_optional_: The optional icon that your field might have. The value should be one of the [Semantic UI icons](https://react.semantic-ui.com/elements/icon/).
16
+
- Previously known as **icon**.
17
+
18
+
-**placeholder**`String`: The placeholder for the element's display. You should fill this in with an example value.
19
+
20
+
-**helpText**`String`_required_: The description for the element's display. You should provide useful information on how the users should fill this field in.
21
+
- Previously known as **description**.
22
+
23
+
-**required**`Boolean`_optional_: Define if the field should be required i.e. display the `*` symbol.
24
+
25
+
-**disabled**`Boolean`_optional_: Define if the field should be displayed as disabled thus no input can be filled.
26
+
27
+
-**hidden**`Boolean`_optional_: Define if the field should be hidden completely. Hiding a field will still retain any value that it already contained.
28
+
7
29
## Input
8
30
9
31
An input field for a single string value.
@@ -14,28 +36,16 @@ An input field for a single string value.
14
36
<Input
15
37
fieldPath="cern:experiment_url"
16
38
label="Experiment URL"
39
+
labelIcon="linkify"
17
40
placeholder="https://your.experiment.url"
18
-
icon="linkify"
19
-
description="URL of the experiment to which the record belongs to."
41
+
helpText="URL of the experiment to which the record belongs to."
20
42
required={true}
21
43
/>
22
44
```
23
45
24
46
### Props
25
47
26
-
-**fieldPath**`String`_required_: The path to the field e.g. `cern:experiment`.
27
-
28
-
-**label**`String`_required_: The label for the element's display. This is used whenever the field should be displayed e.g. upload form, landing page etc.
29
-
30
-
-**placeholder**`String`_required_: The placeholder for the element's display. You should fill this in with an example value.
31
-
32
-
-**description**`String`_required_: The description for the element's display. You should provide useful information on how the users should fill this field in.
33
-
34
-
-**icon**`String`_optional_: The optional icon that your field might have. The value should be one of the [Semantic UI icons](https://react.semantic-ui.com/elements/icon/).
35
-
36
-
-**required**`Boolean`_optional_: Define if the field should be required i.e. display the `*` symbol.
37
-
38
-
-**disabled**`Boolean`_optional_: Define if the field should be displayed as disabled thus no input can be filled.
48
+
No additional props.
39
49
40
50
## NumberInput
41
51
@@ -47,28 +57,16 @@ An input field for numbers e.g. integers, float etc.
47
57
<NumberInput
48
58
fieldPath="cern:experiment_id"
49
59
label="Experiment identifier"
60
+
labelIcon="calculator"
50
61
placeholder="Experiment id..."
51
-
icon="calculator"
52
-
description="Unique integer id of the experiment."
62
+
helpText="Unique integer id of the experiment."
53
63
required={true}
54
64
/>
55
65
```
56
66
57
67
### Props
58
68
59
-
-**fieldPath**`String`_required_: The path to the field e.g. `cern:experiment`.
60
-
61
-
-**label**`String`_required_: The label for the element's display. This is used whenever the field should be displayed e.g. upload form, landing page etc.
62
-
63
-
-**placeholder**`String`_required_: The placeholder for the element's display. You should fill this in with an example value.
64
-
65
-
-**description**`String`_required_: The description for the element's display. You should provide useful information on how the users should fill this field in.
66
-
67
-
-**icon**`String`_optional_: The optional icon that your field might have. The value should be one of the [Semantic UI icons](https://react.semantic-ui.com/elements/icon/).
68
-
69
-
-**required**`Boolean`_optional_: Define if the field should be required i.e. display the `*` symbol.
70
-
71
-
-**disabled**`Boolean`_optional_: Define if the field should be displayed as disabled thus no input can be filled.
69
+
No additional props.
72
70
73
71
## MultiInput
74
72
@@ -80,28 +78,16 @@ An input field for multiple string values.
80
78
<MultiInput
81
79
fieldPath="cern:experiment_keywords"
82
80
label="Experiment keywords"
81
+
labelIcon="tags"
83
82
placeholder="Add keywords..."
84
-
icon="tags"
85
-
description="Keywords to describe the experiment."
83
+
helpText="Keywords to describe the experiment."
86
84
required={false}
87
85
disabled={false}
88
86
/>
89
87
```
90
88
91
89
### Props
92
90
93
-
-**fieldPath**`String`_required_: The path to the field e.g. `cern:experiment`.
94
-
95
-
-**label**`String`_required_: The label for the element's display. This is used whenever the field should be displayed e.g. upload form, landing page etc.
96
-
97
-
-**placeholder**`String`_required_: The placeholder for the element's display. You should fill this in with an example value.
98
-
99
-
-**description**`String`_required_: The description for the element's display. You should provide useful information on how the users should fill this field in.
100
-
101
-
-**icon**`String`_optional_: The optional icon that your field might have. The value should be one of the [Semantic UI icons](https://react.semantic-ui.com/elements/icon/).
102
-
103
-
-**required**`Boolean`_optional_: Define if the field should be required i.e. display the `*` symbol.
104
-
105
91
-**additionLabel**`String`_optional_: The label to show when a user is adding a new value.
106
92
107
93
#### Warning
@@ -118,25 +104,15 @@ A rich input field for HTML text, with a WYSIWYG editor.
118
104
<RichInput
119
105
fieldPath="cern:experiment_abstract"
120
106
label="Experiment abstract"
121
-
description="Long description of the experiment."
122
-
icon="book"
107
+
labelIcon="book"
108
+
helpText="Long description of the experiment."
123
109
required={false}
124
110
editorConfig={toolbar: [ 'bold', 'italic' ]}
125
111
/>
126
112
```
127
113
128
114
### Props
129
115
130
-
-**fieldPath**`String`_required_: The path to the field e.g. `cern:experiment`.
131
-
132
-
-**label**`String`_required_: The label for the element's display. This is used whenever the field should be displayed e.g. upload form, landing page etc.
133
-
134
-
-**description**`String`_required_: The description for the element's display. You should provide useful information on how the users should fill this field in.
135
-
136
-
-**icon**`String`_optional_: The optional icon that your field might have. The value should be one of the [Semantic UI icons](https://react.semantic-ui.com/elements/icon/).
137
-
138
-
-**required**`Boolean`_optional_: Define if the field should be required i.e. display the `*` symbol.
139
-
140
116
-**editorConfig**`Object`_optional_: The config to pass to the underlying HTML WYSIWYG editor as described in the [CKEditor configuration](https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editorconfig-EditorConfig.html) page.
141
117
142
118
## TextArea
@@ -149,23 +125,15 @@ An input field for multi line text.
149
125
<TextArea
150
126
fieldPath="cern:experiment_abstract"
151
127
label="Experiment abstract"
152
-
description="Long description of the experiment."
153
-
icon="book"
128
+
labelIcon="book"
129
+
helpText="Long description of the experiment."
154
130
required={false}
155
131
/>
156
132
```
157
133
158
134
### Props
159
135
160
-
-**fieldPath**`String`_required_: The path to the field e.g. `cern:experiment`.
161
-
162
-
-**label**`String`_required_: The label for the element's display. This is used whenever the field should be displayed e.g. upload form, landing page etc.
163
-
164
-
-**description**`String`_required_: The description for the element's display. You should provide useful information on how the users should fill this field in.
165
-
166
-
-**icon**`String`_optional_: The optional icon that your field might have. The value should be one of the [Semantic UI icons](https://react.semantic-ui.com/elements/icon/).
167
-
168
-
-**required**`Boolean`_optional_: Define if the field should be required i.e. display the `*` symbol.
136
+
No additional props.
169
137
170
138
## Dropdown
171
139
@@ -177,9 +145,9 @@ A dropdown field that renders the complete list of possible options, where the u
177
145
<Dropdown
178
146
fieldPath="cern:experiment_keywords"
179
147
label="Experiment keywords"
148
+
labelIcon="tags"
180
149
placeholder="Select keywords..."
181
-
icon="tags"
182
-
description="List of keywords to select that describe the experiment."
150
+
helpText="List of keywords to select that describe the experiment."
183
151
required={false}
184
152
search={true}
185
153
multiple={false}
@@ -189,18 +157,6 @@ A dropdown field that renders the complete list of possible options, where the u
189
157
190
158
### Props
191
159
192
-
-**fieldPath**`String`_required_: The path to the field e.g. `cern:experiment`.
193
-
194
-
-**label**`String`_required_: The label for the element's display. This is used whenever the field should be displayed e.g. upload form, landing page etc.
195
-
196
-
-**placeholder**`String`_required_: The placeholder for the element's display. You should fill this in with an example value.
197
-
198
-
-**description**`String`_required_: The description for the element's display. You should provide useful information on how the users should fill this field in.
199
-
200
-
-**icon**`String`_optional_: The optional icon that your field might have. The value should be one of the [Semantic UI icons](https://react.semantic-ui.com/elements/icon/).
201
-
202
-
-**required**`Boolean`_optional_: Define if the field should be required i.e. display the `*` symbol.
203
-
204
160
-**search**`Boolean`_optional_: Define if the user should be able to search in the current available options.
205
161
206
162
-**clearable**`Boolean`_optional_: Define if the user can deselect all the selected values.
@@ -217,9 +173,9 @@ A dropdown field that allows the user to search for values, connected to the RES
217
173
<AutocompleteDropdown
218
174
fieldPath="cern:experiment_keywords"
219
175
label="Experiment keywords"
176
+
labelIcon="tags"
220
177
placeholder="Select keywords..."
221
-
icon="tags"
222
-
description="List of keywords to select that describe the experiment."
178
+
helpText="List of keywords to select that describe the experiment."
@@ -230,23 +186,11 @@ A dropdown field that allows the user to search for values, connected to the RES
230
186
231
187
### Props
232
188
233
-
-**fieldPath**`String`_required_: The path to the field e.g. `cern:experiment`.
234
-
235
-
-**label**`String`_required_: The label for the element's display. This is used whenever the field should be displayed e.g. upload form, landing page etc.
236
-
237
-
-**placeholder**`String`_required_: The placeholder for the element's display. You should fill this in with an example value.
238
-
239
-
-**description**`String`_required_: The description for the element's display. You should provide useful information on how the users should fill this field in.
240
-
241
189
-**autocompleteFrom**`String`_required_: The endpoint from which the component should fetch options. This will point to your vocabulary endpoint e.g. `/api/vocabularies/myvocabulary`.
242
190
243
191
-**autocompleteFromAcceptHeader**`String`_optional_: The `Accept` header to send to the `autocompleteFrom` API. If not provided, the **default** header is
244
192
`application/vnd.inveniordm.v1+json`.
245
193
246
-
-**icon**`String`_optional_: The optional icon that your field might have. The value should be one of the [Semantic UI icons](https://react.semantic-ui.com/elements/icon/).
247
-
248
-
-**required**`Boolean`_optional_: Define if the field should be required i.e. display the `*` symbol.
249
-
250
194
-**clearable**`Boolean`_optional_: Define if the user can deselect all the selected values.
251
195
252
196
-**multiple**`Boolean`_optional_ : Define if the field accepts multiple values.
@@ -261,24 +205,14 @@ A field for boolean values. It displays 2 checkboxes for each corresponding valu
261
205
<BooleanCheckbox
262
206
fieldPath="cern:experiment_active"
263
207
label="Active experiment"
264
-
icon="check"
265
-
description="Mark if the experiment is active."
208
+
labelIcon="check"
209
+
helpText="Mark if the experiment is active."
266
210
required={true}
267
211
/>
268
212
```
269
213
270
214
### Props
271
215
272
-
-**fieldPath**`String`_required_: The path to the field e.g. `cern:experiment`.
273
-
274
-
-**label**`String`_required_: The label for the element's display. This is used whenever the field should be displayed e.g. upload form, landing page etc.
275
-
276
216
-**trueLabel**`String`_required_: The label for the element's display when the value is `true`. This is used whenever the `true` value should be displayed e.g. upload form, landing page etc.
277
217
278
218
-**falseLabel**`String`_required_: The label for the element's display when the value is `false`. This is used whenever the `false` value should be displayed e.g. upload form, landing page etc.
279
-
280
-
-**description**`String`_required_: The description for the element's display. You should provide useful information on how the users should fill this field in.
281
-
282
-
-**icon**`String`_optional_: The optional icon that your field might have. The value should be one of the [Semantic UI icons](https://react.semantic-ui.com/elements/icon/).
283
-
284
-
-**required**`Boolean`_optional_: Define if the field should be required i.e. display the `*` symbol.
0 commit comments