Skip to content

Commit faa65ed

Browse files
committed
docs: operate: common props for UI widgets
* 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"
1 parent 0f52752 commit faa65ed

File tree

1 file changed

+41
-107
lines changed
  • docs/operate/customize/metadata/custom_fields

1 file changed

+41
-107
lines changed

docs/operate/customize/metadata/custom_fields/widgets.md

Lines changed: 41 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ _Introduced in v10_
44

55
The following document is a reference guide for all the React UI widgets available for custom fields.
66

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+
729
## Input
830

931
An input field for a single string value.
@@ -14,28 +36,16 @@ An input field for a single string value.
1436
<Input
1537
fieldPath="cern:experiment_url"
1638
label="Experiment URL"
39+
labelIcon="linkify"
1740
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."
2042
required={true}
2143
/>
2244
```
2345

2446
### Props
2547

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.
3949

4050
## NumberInput
4151

@@ -47,28 +57,16 @@ An input field for numbers e.g. integers, float etc.
4757
<NumberInput
4858
fieldPath="cern:experiment_id"
4959
label="Experiment identifier"
60+
labelIcon="calculator"
5061
placeholder="Experiment id..."
51-
icon="calculator"
52-
description="Unique integer id of the experiment."
62+
helpText="Unique integer id of the experiment."
5363
required={true}
5464
/>
5565
```
5666

5767
### Props
5868

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.
7270

7371
## MultiInput
7472

@@ -80,28 +78,16 @@ An input field for multiple string values.
8078
<MultiInput
8179
fieldPath="cern:experiment_keywords"
8280
label="Experiment keywords"
81+
labelIcon="tags"
8382
placeholder="Add keywords..."
84-
icon="tags"
85-
description="Keywords to describe the experiment."
83+
helpText="Keywords to describe the experiment."
8684
required={false}
8785
disabled={false}
8886
/>
8987
```
9088

9189
### Props
9290

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-
10591
- **additionLabel** `String` _optional_: The label to show when a user is adding a new value.
10692

10793
#### Warning
@@ -118,25 +104,15 @@ A rich input field for HTML text, with a WYSIWYG editor.
118104
<RichInput
119105
fieldPath="cern:experiment_abstract"
120106
label="Experiment abstract"
121-
description="Long description of the experiment."
122-
icon="book"
107+
labelIcon="book"
108+
helpText="Long description of the experiment."
123109
required={false}
124110
editorConfig={toolbar: [ 'bold', 'italic' ]}
125111
/>
126112
```
127113

128114
### Props
129115

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-
140116
- **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.
141117

142118
## TextArea
@@ -149,23 +125,15 @@ An input field for multi line text.
149125
<TextArea
150126
fieldPath="cern:experiment_abstract"
151127
label="Experiment abstract"
152-
description="Long description of the experiment."
153-
icon="book"
128+
labelIcon="book"
129+
helpText="Long description of the experiment."
154130
required={false}
155131
/>
156132
```
157133

158134
### Props
159135

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.
169137

170138
## Dropdown
171139

@@ -177,9 +145,9 @@ A dropdown field that renders the complete list of possible options, where the u
177145
<Dropdown
178146
fieldPath="cern:experiment_keywords"
179147
label="Experiment keywords"
148+
labelIcon="tags"
180149
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."
183151
required={false}
184152
search={true}
185153
multiple={false}
@@ -189,18 +157,6 @@ A dropdown field that renders the complete list of possible options, where the u
189157

190158
### Props
191159

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-
204160
- **search** `Boolean` _optional_: Define if the user should be able to search in the current available options.
205161

206162
- **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
217173
<AutocompleteDropdown
218174
fieldPath="cern:experiment_keywords"
219175
label="Experiment keywords"
176+
labelIcon="tags"
220177
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."
223179
autocompleteFrom="/api/vocabularies/myexperimentkeywords"
224180
autocompleteFromAcceptHeader="application/vnd.inveniordm.v1+json"
225181
required={false}
@@ -230,23 +186,11 @@ A dropdown field that allows the user to search for values, connected to the RES
230186

231187
### Props
232188

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-
241189
- **autocompleteFrom** `String` _required_: The endpoint from which the component should fetch options. This will point to your vocabulary endpoint e.g. `/api/vocabularies/myvocabulary`.
242190

243191
- **autocompleteFromAcceptHeader** `String` _optional_: The `Accept` header to send to the `autocompleteFrom` API. If not provided, the **default** header is
244192
`application/vnd.inveniordm.v1+json`.
245193

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-
250194
- **clearable** `Boolean` _optional_: Define if the user can deselect all the selected values.
251195

252196
- **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
261205
<BooleanCheckbox
262206
fieldPath="cern:experiment_active"
263207
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."
266210
required={true}
267211
/>
268212
```
269213

270214
### Props
271215

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-
276216
- **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.
277217

278218
- **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

Comments
 (0)