Skip to content

Commit 6ea9b70

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 6ea9b70

File tree

1 file changed

+25
-91
lines changed
  • docs/operate/customize/metadata/custom_fields

1 file changed

+25
-91
lines changed

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

Lines changed: 25 additions & 91 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.
@@ -23,19 +45,7 @@ An input field for a single string value.
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

@@ -56,19 +66,7 @@ An input field for numbers e.g. integers, float etc.
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

@@ -90,18 +88,6 @@ An input field for multiple string values.
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
@@ -127,16 +113,6 @@ A rich input field for HTML text, with a WYSIWYG editor.
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
@@ -157,15 +133,7 @@ An input field for multi line text.
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

@@ -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.
@@ -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.
@@ -269,16 +213,6 @@ A field for boolean values. It displays 2 checkboxes for each corresponding valu
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)