@dhis2/ui 8.2.2 → 8.2.5
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/API.md +2657 -0
- package/package.json +48 -48
package/API.md
CHANGED
|
@@ -1,3 +1,347 @@
|
|
|
1
|
+
### AlertBar
|
|
2
|
+
|
|
3
|
+
#### Usage
|
|
4
|
+
|
|
5
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import { AlertBar } from '@dhis2/ui'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
#### Props
|
|
12
|
+
|
|
13
|
+
| Name | Type | Default | Required | Description |
|
|
14
|
+
| --------- | -------- | ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------- |
|
|
15
|
+
| actions | custom | | | An array of 0-2 action objects |
|
|
16
|
+
| children | string | | | The message string for the alert |
|
|
17
|
+
| className | string | | | |
|
|
18
|
+
| critical | custom | | | Alert bars with `critical` will not autohide |
|
|
19
|
+
| dataTest | string | `'dhis2-uicore-alertbar'` | | |
|
|
20
|
+
| duration | number | `8000` | | |
|
|
21
|
+
| hidden | boolean | | | |
|
|
22
|
+
| icon | custom | `true` | | A specific icon to override the default icon in the bar.<br/>If `false` is provided, no icon will be shown. |
|
|
23
|
+
| permanent | boolean | | | |
|
|
24
|
+
| success | custom | | | |
|
|
25
|
+
| warning | custom | | | Alert bars with `warning` will not autohide |
|
|
26
|
+
| onHidden | function | | | |
|
|
27
|
+
|
|
28
|
+
### AlertStack
|
|
29
|
+
|
|
30
|
+
#### Usage
|
|
31
|
+
|
|
32
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import { AlertStack } from '@dhis2/ui'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### Props
|
|
39
|
+
|
|
40
|
+
| Name | Type | Default | Required | Description |
|
|
41
|
+
| --------- | ------ | --------------------------- | -------- | ----------- |
|
|
42
|
+
| children | node | | | |
|
|
43
|
+
| className | string | | | |
|
|
44
|
+
| dataTest | string | `'dhis2-uicore-alertstack'` | | |
|
|
45
|
+
|
|
46
|
+
### Box
|
|
47
|
+
|
|
48
|
+
#### Usage
|
|
49
|
+
|
|
50
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
import { Box } from '@dhis2/ui'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Props
|
|
57
|
+
|
|
58
|
+
| Name | Type | Default | Required | Description |
|
|
59
|
+
| --------- | ------ | -------------------- | -------- | ----------- |
|
|
60
|
+
| children | node | | | |
|
|
61
|
+
| className | string | | | |
|
|
62
|
+
| dataTest | string | `'dhis2-uicore-box'` | | |
|
|
63
|
+
| height | string | | | |
|
|
64
|
+
| marginTop | string | | | |
|
|
65
|
+
| maxHeight | string | | | |
|
|
66
|
+
| maxWidth | string | | | |
|
|
67
|
+
| minHeight | string | | | |
|
|
68
|
+
| minWidth | string | | | |
|
|
69
|
+
| overflow | string | | | |
|
|
70
|
+
| width | string | | | |
|
|
71
|
+
|
|
72
|
+
### Button
|
|
73
|
+
|
|
74
|
+
#### Usage
|
|
75
|
+
|
|
76
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
import { Button } from '@dhis2/ui'
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### Props
|
|
83
|
+
|
|
84
|
+
| Name | Type | Default | Required | Description |
|
|
85
|
+
| ------------ | ----------------------------- | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
86
|
+
| children | node | | | Component to render inside the button |
|
|
87
|
+
| className | string | | | A className that will be passed to the `<button>` element |
|
|
88
|
+
| dataTest | string | `'dhis2-uicore-button'` | | A string that will be applied as a `data-test` attribute on the button element<br/>for identification during testing |
|
|
89
|
+
| destructive | custom | | | Indicates that the button makes potentially dangerous<br/>deletions or data changes.<br/>Mutually exclusive with `primary` and `secondary` props |
|
|
90
|
+
| disabled | boolean | | | Applies a greyed-out appearance and makes the button non-interactive |
|
|
91
|
+
| icon | element | | | An icon element to display inside the button |
|
|
92
|
+
| initialFocus | boolean | | | Use this variant to capture the initial focus on the page. |
|
|
93
|
+
| large | custom | | | Makes the button large. Mutually exclusive with `small` |
|
|
94
|
+
| loading | boolean | | | Sets the button into a loading state |
|
|
95
|
+
| name | string | | | Sets `name` attribute on button element.<br/>Gets passed as part of the first argument to callbacks (see `onClick`). |
|
|
96
|
+
| primary | custom | | | Applies 'primary' button appearance.<br/>Mutually exclusive with `destructive` and `secondary` props |
|
|
97
|
+
| secondary | custom | | | Applies 'secondary' button appearance.<br/>Mutually exclusive with `primary` and `destructive` props |
|
|
98
|
+
| small | custom | | | Makes the button small. Mutually exclusive with `large` prop |
|
|
99
|
+
| tabIndex | string | | | Tab index for focusing the button with a keyboard |
|
|
100
|
+
| toggled | boolean | | | Changes appearance of button to an on/off state |
|
|
101
|
+
| type | 'submit' │ 'reset' │ 'button' | `'button'` | | Sets `type` attribute on `<button>` element |
|
|
102
|
+
| value | string | | | Value associated with the button.<br/>Gets passed as part of the first argument to callbacks (see `onClick`). |
|
|
103
|
+
| onBlur | function | | | Callback to trigger on de-focus (blur).<br/>Called with same args as `onClick` |
|
|
104
|
+
| onClick | function | | | Callback to trigger on click.<br/>Called with args `({ value, name }, event)` |
|
|
105
|
+
| onFocus | function | | | Callback to trigger on focus. Called with same args as `onClick` |
|
|
106
|
+
|
|
107
|
+
### ButtonStrip
|
|
108
|
+
|
|
109
|
+
#### Usage
|
|
110
|
+
|
|
111
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
import { ButtonStrip } from '@dhis2/ui'
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### Props
|
|
118
|
+
|
|
119
|
+
| Name | Type | Default | Required | Description |
|
|
120
|
+
| --------- | ------ | ---------------------------- | -------- | ----------------------------------------------------------------------- |
|
|
121
|
+
| children | node | | | |
|
|
122
|
+
| className | string | | | |
|
|
123
|
+
| dataTest | string | `'dhis2-uicore-buttonstrip'` | | |
|
|
124
|
+
| end | custom | | | Horizontal alignment for buttons. Mutually exclusive with `middle` prop |
|
|
125
|
+
| middle | custom | | | Horizontal alignment. Mutually exclusive with `end` prop |
|
|
126
|
+
|
|
127
|
+
### DropdownButton
|
|
128
|
+
|
|
129
|
+
#### Usage
|
|
130
|
+
|
|
131
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
import { DropdownButton } from '@dhis2/ui'
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Props
|
|
138
|
+
|
|
139
|
+
| Name | Type | Default | Required | Description |
|
|
140
|
+
| ------------ | ----------------------------- | ------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
141
|
+
| children | node | | | Children to render inside the buton |
|
|
142
|
+
| className | string | | | |
|
|
143
|
+
| component | element | | | Component to show/hide when button is clicked |
|
|
144
|
+
| dataTest | string | `'dhis2-uicore-dropdownbutton'` | | |
|
|
145
|
+
| destructive | custom | | | Button variant. Mutually exclusive with `primary` and `secondary` props |
|
|
146
|
+
| disabled | boolean | | | Make the button non-interactive |
|
|
147
|
+
| icon | element | | | |
|
|
148
|
+
| initialFocus | boolean | | | Grants button initial focus on the page |
|
|
149
|
+
| large | custom | | | Button size. Mutually exclusive with `small` prop |
|
|
150
|
+
| name | string | | | |
|
|
151
|
+
| open | boolean | | | Controls popper visibility. When implementing this prop the component becomes a controlled component |
|
|
152
|
+
| primary | custom | | | Button variant. Mutually exclusive with `destructive` and `secondary` props |
|
|
153
|
+
| secondary | custom | | | Button variant. Mutually exclusive with `primary` and `destructive` props |
|
|
154
|
+
| small | custom | | | Button size. Mutually exclusive with `large` prop |
|
|
155
|
+
| tabIndex | string | | | |
|
|
156
|
+
| type | 'submit' │ 'reset' │ 'button' | | | Type of button. Can take advantage of different default behavior |
|
|
157
|
+
| value | string | | | |
|
|
158
|
+
| onClick | custom | | | Callback triggered on click.<br/>Called with signature `({ name: string, value: string, open: bool }, event)`<br/>Is required when using the `open` prop to override the internal<br/>state. |
|
|
159
|
+
|
|
160
|
+
### SplitButton
|
|
161
|
+
|
|
162
|
+
#### Usage
|
|
163
|
+
|
|
164
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
165
|
+
|
|
166
|
+
```js
|
|
167
|
+
import { SplitButton } from '@dhis2/ui'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### Props
|
|
171
|
+
|
|
172
|
+
| Name | Type | Default | Required | Description |
|
|
173
|
+
| ------------ | ----------------------------- | ---------------------------- | -------- | ------------------------------------------------------------------------------------------------------------- |
|
|
174
|
+
| children | string | | | |
|
|
175
|
+
| className | string | | | |
|
|
176
|
+
| component | element | | | Component to render when the dropdown is opened |
|
|
177
|
+
| dataTest | string | `'dhis2-uicore-splitbutton'` | | |
|
|
178
|
+
| destructive | custom | | | Applies 'destructive' appearance to indicate purpose. Mutually exclusive with `primary` and `secondary` props |
|
|
179
|
+
| disabled | boolean | | | Disables the button and makes it uninteractive |
|
|
180
|
+
| icon | element | | | An icon to add inside the button |
|
|
181
|
+
| initialFocus | boolean | | | Grants the button the initial focus |
|
|
182
|
+
| large | custom | | | Changes button size. Mutually exclusive with `small` prop |
|
|
183
|
+
| name | string | | | |
|
|
184
|
+
| primary | custom | | | Applies 'primary' appearance to indicate purpose. Mutually exclusive with `destructive` and `secondary` props |
|
|
185
|
+
| secondary | custom | | | Applies 'secondary' appearance to indicate purpose. Mutually exclusive with `primary` and `destructive` props |
|
|
186
|
+
| small | custom | | | Changes button size. Mutually exclusive with `large` prop |
|
|
187
|
+
| tabIndex | string | | | |
|
|
188
|
+
| type | 'submit' │ 'reset' │ 'button' | | | Type of button. Applied to html `button` element |
|
|
189
|
+
| value | string | | | Value associated with the button. Passed in object to onClick handler |
|
|
190
|
+
| onClick | function | | | |
|
|
191
|
+
|
|
192
|
+
### Card
|
|
193
|
+
|
|
194
|
+
#### Usage
|
|
195
|
+
|
|
196
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
197
|
+
|
|
198
|
+
```js
|
|
199
|
+
import { Card } from '@dhis2/ui'
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Props
|
|
203
|
+
|
|
204
|
+
| Name | Type | Default | Required | Description |
|
|
205
|
+
| --------- | ------ | --------------------- | -------- | ----------- |
|
|
206
|
+
| children | node | | | |
|
|
207
|
+
| className | string | | | |
|
|
208
|
+
| dataTest | string | `'dhis2-uicore-card'` | | |
|
|
209
|
+
|
|
210
|
+
### Center
|
|
211
|
+
|
|
212
|
+
#### Usage
|
|
213
|
+
|
|
214
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
215
|
+
|
|
216
|
+
```js
|
|
217
|
+
import { Center } from '@dhis2/ui'
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
#### Props
|
|
221
|
+
|
|
222
|
+
| Name | Type | Default | Required | Description |
|
|
223
|
+
| --------- | --------------------------- | -------------------------------- | -------- | ------------------ |
|
|
224
|
+
| children | node | | | |
|
|
225
|
+
| className | string | | | |
|
|
226
|
+
| dataTest | string | `'dhis2-uicore-centeredcontent'` | | |
|
|
227
|
+
| position | 'top' │ 'middle' │ 'bottom' | `'middle'` | | Vertical alignment |
|
|
228
|
+
|
|
229
|
+
### Checkbox
|
|
230
|
+
|
|
231
|
+
#### Usage
|
|
232
|
+
|
|
233
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
234
|
+
|
|
235
|
+
```js
|
|
236
|
+
import { Checkbox } from '@dhis2/ui'
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### Props
|
|
240
|
+
|
|
241
|
+
| Name | Type | Default | Required | Description |
|
|
242
|
+
| ------------- | -------- | ------------------------- | -------- | --------------------------------------- |
|
|
243
|
+
| checked | custom | `false` | | |
|
|
244
|
+
| className | string | | | |
|
|
245
|
+
| dataTest | string | `'dhis2-uicore-checkbox'` | | |
|
|
246
|
+
| dense | boolean | | | |
|
|
247
|
+
| disabled | boolean | | | |
|
|
248
|
+
| error | custom | | | |
|
|
249
|
+
| indeterminate | custom | `false` | | |
|
|
250
|
+
| initialFocus | boolean | | | |
|
|
251
|
+
| label | node | | | |
|
|
252
|
+
| name | string | | | |
|
|
253
|
+
| tabIndex | string | | | |
|
|
254
|
+
| valid | custom | | | |
|
|
255
|
+
| value | string | | | |
|
|
256
|
+
| warning | custom | | | |
|
|
257
|
+
| onBlur | function | | | |
|
|
258
|
+
| onChange | function | | | Called with signature `(object, event)` |
|
|
259
|
+
| onFocus | function | | | |
|
|
260
|
+
|
|
261
|
+
### CheckboxField
|
|
262
|
+
|
|
263
|
+
#### Usage
|
|
264
|
+
|
|
265
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
266
|
+
|
|
267
|
+
```js
|
|
268
|
+
import { CheckboxField } from '@dhis2/ui'
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### Props
|
|
272
|
+
|
|
273
|
+
| Name | Type | Default | Required | Description |
|
|
274
|
+
| -------------- | -------- | --------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
275
|
+
| checked | boolean | | | |
|
|
276
|
+
| className | string | | | |
|
|
277
|
+
| dataTest | string | `'dhis2-uiwidgets-checkboxfield'` | | |
|
|
278
|
+
| dense | boolean | | | Smaller dimensions for information-dense layouts |
|
|
279
|
+
| disabled | boolean | | | Disables the checkbox |
|
|
280
|
+
| error | custom | | | Applies 'error' styling to checkbox and validation text for feedback. Mutually exclusive with `warning` and `valid` props |
|
|
281
|
+
| helpText | string | | | Useful instructions for the user |
|
|
282
|
+
| initialFocus | boolean | | | |
|
|
283
|
+
| label | node | | | Labels the checkbox |
|
|
284
|
+
| name | string | | | Name associate with the checkbox. Passed in object as argument to event handlers |
|
|
285
|
+
| required | boolean | | | Adds an asterisk to indicate this field is required |
|
|
286
|
+
| tabIndex | string | | | |
|
|
287
|
+
| valid | custom | | | Applies 'valid' styling to checkbox and validation text for feedback. Mutually exclusive with `warning` and `error` props |
|
|
288
|
+
| validationText | string | | | Adds text below the checkbox to provide validation feedback. Acquires styles from `valid`, `warning` and `error` statuses |
|
|
289
|
+
| value | string | | | Value associated with the checkbox. Passed in object as argument to event handlers |
|
|
290
|
+
| warning | custom | | | Applies 'warning' styling to checkbox and validation text for feedback. Mutually exclusive with `valid` and `error` props |
|
|
291
|
+
| onBlur | function | | | Called with signature `({ name: string, value: string, checked: bool }, event)` |
|
|
292
|
+
| onChange | function | | | Called with signature `({ name: string, value: string, checked: bool }, event)` |
|
|
293
|
+
| onFocus | function | | | Called with signature `({ name: string, value: string, checked: bool }, event)` |
|
|
294
|
+
|
|
295
|
+
### Chip
|
|
296
|
+
|
|
297
|
+
#### Usage
|
|
298
|
+
|
|
299
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
300
|
+
|
|
301
|
+
```js
|
|
302
|
+
import { Chip } from '@dhis2/ui'
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
#### Props
|
|
306
|
+
|
|
307
|
+
| Name | Type | Default | Required | Description |
|
|
308
|
+
| ------------ | -------- | --------------------- | -------- | -------------------------------------- |
|
|
309
|
+
| children | any | | | |
|
|
310
|
+
| className | string | | | |
|
|
311
|
+
| dataTest | string | `'dhis2-uicore-chip'` | | |
|
|
312
|
+
| dense | boolean | | | |
|
|
313
|
+
| disabled | boolean | | | |
|
|
314
|
+
| dragging | boolean | | | |
|
|
315
|
+
| icon | element | | | |
|
|
316
|
+
| marginBottom | number | `4` | | `margin-bottom` value, applied in `px` |
|
|
317
|
+
| marginLeft | number | `4` | | `margin-left` value, applied in `px` |
|
|
318
|
+
| marginRight | number | `4` | | `margin-right` value, applied in `px` |
|
|
319
|
+
| marginTop | number | `4` | | `margin-top` value, applied in `px` |
|
|
320
|
+
| overflow | boolean | | | |
|
|
321
|
+
| selected | boolean | | | |
|
|
322
|
+
| onClick | function | | | |
|
|
323
|
+
| onRemove | function | | | |
|
|
324
|
+
|
|
325
|
+
### Cover
|
|
326
|
+
|
|
327
|
+
#### Usage
|
|
328
|
+
|
|
329
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
330
|
+
|
|
331
|
+
```js
|
|
332
|
+
import { Cover } from '@dhis2/ui'
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
#### Props
|
|
336
|
+
|
|
337
|
+
| Name | Type | Default | Required | Description |
|
|
338
|
+
| ----------- | -------- | ------------------------------- | -------- | ----------------------------------------------- |
|
|
339
|
+
| children | node | | | |
|
|
340
|
+
| className | string | | | |
|
|
341
|
+
| dataTest | string | `'dhis2-uicore-componentcover'` | | |
|
|
342
|
+
| translucent | boolean | | | Adds a semi-transparent background to the cover |
|
|
343
|
+
| onClick | function | | | |
|
|
344
|
+
|
|
1
345
|
### CssReset
|
|
2
346
|
|
|
3
347
|
#### Usage
|
|
@@ -8,6 +352,262 @@
|
|
|
8
352
|
import { CssReset } from '@dhis2/ui'
|
|
9
353
|
```
|
|
10
354
|
|
|
355
|
+
### CssVariables
|
|
356
|
+
|
|
357
|
+
#### Usage
|
|
358
|
+
|
|
359
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
360
|
+
|
|
361
|
+
```js
|
|
362
|
+
import { CssVariables } from '@dhis2/ui'
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
#### Props
|
|
366
|
+
|
|
367
|
+
| Name | Type | Default | Required | Description |
|
|
368
|
+
| ---------- | ------- | ------- | -------- | ----------- |
|
|
369
|
+
| colors | boolean | `false` | | |
|
|
370
|
+
| elevations | boolean | `false` | | |
|
|
371
|
+
| layers | boolean | `false` | | |
|
|
372
|
+
| spacers | boolean | `false` | | |
|
|
373
|
+
| theme | boolean | `false` | | |
|
|
374
|
+
|
|
375
|
+
### Divider
|
|
376
|
+
|
|
377
|
+
#### Usage
|
|
378
|
+
|
|
379
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
380
|
+
|
|
381
|
+
```js
|
|
382
|
+
import { Divider } from '@dhis2/ui'
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
#### Props
|
|
386
|
+
|
|
387
|
+
| Name | Type | Default | Required | Description |
|
|
388
|
+
| --------- | ------- | ------------------------ | -------- | ----------- |
|
|
389
|
+
| className | string | | | |
|
|
390
|
+
| dataTest | string | `'dhis2-uicore-divider'` | | |
|
|
391
|
+
| dense | boolean | | | |
|
|
392
|
+
| margin | string | `${spacers.dp8} 0` | | |
|
|
393
|
+
|
|
394
|
+
### Field
|
|
395
|
+
|
|
396
|
+
#### Usage
|
|
397
|
+
|
|
398
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
399
|
+
|
|
400
|
+
```js
|
|
401
|
+
import { Field } from '@dhis2/ui'
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
#### Props
|
|
405
|
+
|
|
406
|
+
| Name | Type | Default | Required | Description |
|
|
407
|
+
| -------------- | ------- | ---------------------- | -------- | --------------------------------------------------------------------------------------- |
|
|
408
|
+
| children | node | | | |
|
|
409
|
+
| className | string | | | |
|
|
410
|
+
| dataTest | string | `'dhis2-uicore-field'` | | |
|
|
411
|
+
| disabled | boolean | | | Disabled status, shown when mouse is over label |
|
|
412
|
+
| error | custom | | | Field status. Mutually exclusive with `valid` and `warning` props |
|
|
413
|
+
| helpText | string | | | Useful text within the field |
|
|
414
|
+
| label | string | | | Label at the top of the field |
|
|
415
|
+
| name | string | | | `name` will become the target of the `for`/`htmlFor` attribute on the `<label>` element |
|
|
416
|
+
| required | boolean | | | Inidcates this field is required |
|
|
417
|
+
| valid | custom | | | Field status. Mutually exclusive with `error` and `warning` props |
|
|
418
|
+
| validationText | string | | | Feedback given related to validation status of field |
|
|
419
|
+
| warning | custom | | | Field status. Mutually exclusive with `valid` and `error` props |
|
|
420
|
+
|
|
421
|
+
### FieldGroup
|
|
422
|
+
|
|
423
|
+
#### Usage
|
|
424
|
+
|
|
425
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
426
|
+
|
|
427
|
+
```js
|
|
428
|
+
import { FieldGroup } from '@dhis2/ui'
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
#### Props
|
|
432
|
+
|
|
433
|
+
| Name | Type | Default | Required | Description |
|
|
434
|
+
| -------------- | ------- | --------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
435
|
+
| children | node | | | |
|
|
436
|
+
| className | string | | | |
|
|
437
|
+
| dataTest | string | `'dhis2-uiwidgets-fieldsetfield'` | | |
|
|
438
|
+
| disabled | boolean | | | Disables the form controls within |
|
|
439
|
+
| error | custom | | | Applies 'error' styling to validation text for feedback. Mutually exclusive with `warning` and `valid` props |
|
|
440
|
+
| helpText | string | | | Useful instructions for the user |
|
|
441
|
+
| label | string | | | Labels the Field Group |
|
|
442
|
+
| name | string | | | Name associate with the Field Group. Passed in object as argument to event handlers |
|
|
443
|
+
| required | boolean | | | Adds an asterisk to indicate this field is required |
|
|
444
|
+
| valid | custom | | | Applies 'valid' styling to validation text for feedback. Mutually exclusive with `warning` and `error` props |
|
|
445
|
+
| validationText | string | | | Adds text at the bottom of the field to provide validation feedback. Acquires styles from `valid`, `warning` and `error` statuses |
|
|
446
|
+
| warning | custom | | | Applies 'warning' styling to validation text for feedback. Mutually exclusive with `valid` and `error` props |
|
|
447
|
+
|
|
448
|
+
### FieldSet
|
|
449
|
+
|
|
450
|
+
#### Usage
|
|
451
|
+
|
|
452
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
453
|
+
|
|
454
|
+
```js
|
|
455
|
+
import { FieldSet } from '@dhis2/ui'
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
#### Props
|
|
459
|
+
|
|
460
|
+
| Name | Type | Default | Required | Description |
|
|
461
|
+
| --------- | ------ | ------------------------- | -------- | ----------- |
|
|
462
|
+
| children | node | | | |
|
|
463
|
+
| className | string | | | |
|
|
464
|
+
| dataTest | string | `'dhis2-uicore-fieldset'` | | |
|
|
465
|
+
|
|
466
|
+
### FileInput
|
|
467
|
+
|
|
468
|
+
#### Usage
|
|
469
|
+
|
|
470
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
471
|
+
|
|
472
|
+
```js
|
|
473
|
+
import { FileInput } from '@dhis2/ui'
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
#### Props
|
|
477
|
+
|
|
478
|
+
| Name | Type | Default | Required | Description |
|
|
479
|
+
| ------------ | -------- | -------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
480
|
+
| accept | string | `'*'` | | The `accept` attribute of the [native file input](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) |
|
|
481
|
+
| buttonLabel | string | | | |
|
|
482
|
+
| className | string | | | |
|
|
483
|
+
| dataTest | string | `'dhis2-uicore-fileinput'` | | |
|
|
484
|
+
| disabled | boolean | | | |
|
|
485
|
+
| error | custom | | | Input status. Mutually exclusive with `warning` and `valid` |
|
|
486
|
+
| initialFocus | boolean | | | |
|
|
487
|
+
| large | custom | | | Button size. Mutually exclusive with `small` |
|
|
488
|
+
| multiple | boolean | | | The `multiple` attribute of the [native file input](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#multiple) |
|
|
489
|
+
| name | string | | | |
|
|
490
|
+
| small | custom | | | Button size. Mutually exclusive with `large` |
|
|
491
|
+
| tabIndex | string | | | |
|
|
492
|
+
| valid | custom | | | Input status. Mutually exclusive with `warning` and `error` |
|
|
493
|
+
| warning | custom | | | Input status. Mutually exclusive with `valid` and `error` |
|
|
494
|
+
| onBlur | function | | | Called with signature `(object, event)` |
|
|
495
|
+
| onChange | function | | | Called with signature `(object, event)` |
|
|
496
|
+
| onFocus | function | | | Called with signature `(object, event)` |
|
|
497
|
+
|
|
498
|
+
### FileInputField
|
|
499
|
+
|
|
500
|
+
#### Usage
|
|
501
|
+
|
|
502
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
503
|
+
|
|
504
|
+
```js
|
|
505
|
+
import { FileInputField } from '@dhis2/ui'
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
#### Props
|
|
509
|
+
|
|
510
|
+
| Name | Type | Default | Required | Description |
|
|
511
|
+
| -------------- | ----------------- | -------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
512
|
+
| accept | string | `'*'` | | The `accept` attribute of the [native file input](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) |
|
|
513
|
+
| buttonLabel | string │ function | `() => i18n.t('Upload a file')` | | Text on the button |
|
|
514
|
+
| children | node | | | |
|
|
515
|
+
| className | string | | | |
|
|
516
|
+
| dataTest | string | `'dhis2-uiwidgets-fileinputfield'` | | |
|
|
517
|
+
| disabled | boolean | | | Disables the button |
|
|
518
|
+
| error | custom | | | Applies 'error' styling to the validation text. Mutually exclusive with `warning` and `valid` props |
|
|
519
|
+
| helpText | string | | | Useful guiding text for the user |
|
|
520
|
+
| initialFocus | boolean | | | |
|
|
521
|
+
| label | string | | | A descriptive label above the button |
|
|
522
|
+
| large | custom | | | Size of the button. Mutually exclusive with the `small` prop |
|
|
523
|
+
| multiple | boolean | | | The `multiple` attribute of the [native file input](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#multiple) |
|
|
524
|
+
| name | string | | | Name associated with input. Passed to event handler callbacks |
|
|
525
|
+
| placeholder | string │ function | `() => i18n.t('No file uploaded yet')` | | Placeholder below the button |
|
|
526
|
+
| required | boolean | | | Adds an asterisk to indicate this field is required |
|
|
527
|
+
| small | custom | | | Size of the button. Mutually exclusive with the `large` prop |
|
|
528
|
+
| tabIndex | string | | | |
|
|
529
|
+
| valid | custom | | | Applies 'valid' styling to the validation text. Mutually exclusive with `warning` and `error` props |
|
|
530
|
+
| validationText | string | | | Text below the button that provides validation feedback |
|
|
531
|
+
| warning | custom | | | Applies 'warning' styling to the validation text. Mutually exclusive with `valid` and `error` props |
|
|
532
|
+
| onBlur | function | | | |
|
|
533
|
+
| onChange | function | | | Called with signature `({ name: string, files: [] }, event)` |
|
|
534
|
+
| onFocus | function | | | |
|
|
535
|
+
|
|
536
|
+
### FileListItem
|
|
537
|
+
|
|
538
|
+
#### Usage
|
|
539
|
+
|
|
540
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
541
|
+
|
|
542
|
+
```js
|
|
543
|
+
import { FileListItem } from '@dhis2/ui'
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
#### Props
|
|
547
|
+
|
|
548
|
+
| Name | Type | Default | Required | Description |
|
|
549
|
+
| ---------- | -------- | ----------------------------- | -------- | ----------- |
|
|
550
|
+
| onRemove | function | | \* | |
|
|
551
|
+
| cancelText | string | | | |
|
|
552
|
+
| className | string | | | |
|
|
553
|
+
| dataTest | string | `'dhis2-uicore-filelistitem'` | | |
|
|
554
|
+
| label | string | | | |
|
|
555
|
+
| loading | boolean | | | |
|
|
556
|
+
| removeText | string | | | |
|
|
557
|
+
| onCancel | function | | | |
|
|
558
|
+
|
|
559
|
+
### FileListPlaceholder
|
|
560
|
+
|
|
561
|
+
#### Usage
|
|
562
|
+
|
|
563
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
564
|
+
|
|
565
|
+
```js
|
|
566
|
+
import { FileListPlaceholder } from '@dhis2/ui'
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
#### Props
|
|
570
|
+
|
|
571
|
+
| Name | Type | Default | Required | Description |
|
|
572
|
+
| -------- | ------ | ------------------------------------ | -------- | ----------- |
|
|
573
|
+
| children | string | | | |
|
|
574
|
+
| dataTest | string | `'dhis2-uicore-filelistplaceholder'` | | |
|
|
575
|
+
|
|
576
|
+
### FileList
|
|
577
|
+
|
|
578
|
+
#### Usage
|
|
579
|
+
|
|
580
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
581
|
+
|
|
582
|
+
```js
|
|
583
|
+
import { FileList } from '@dhis2/ui'
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
#### Props
|
|
587
|
+
|
|
588
|
+
| Name | Type | Default | Required | Description |
|
|
589
|
+
| --------- | ------ | ------------------------- | -------- | ----------- |
|
|
590
|
+
| children | node | | | |
|
|
591
|
+
| className | string | | | |
|
|
592
|
+
| dataTest | string | `'dhis2-uicore-filelist'` | | |
|
|
593
|
+
|
|
594
|
+
### HeaderBar
|
|
595
|
+
|
|
596
|
+
#### Usage
|
|
597
|
+
|
|
598
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
599
|
+
|
|
600
|
+
```js
|
|
601
|
+
import { HeaderBar } from '@dhis2/ui'
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
#### Props
|
|
605
|
+
|
|
606
|
+
| Name | Type | Default | Required | Description |
|
|
607
|
+
| --------- | ------ | ------- | -------- | ----------- |
|
|
608
|
+
| appName | string | | | |
|
|
609
|
+
| className | string | | | |
|
|
610
|
+
|
|
11
611
|
### Logo
|
|
12
612
|
|
|
13
613
|
#### Usage
|
|
@@ -17,3 +617,2060 @@ import { CssReset } from '@dhis2/ui'
|
|
|
17
617
|
```js
|
|
18
618
|
import { Logo } from '@dhis2/ui'
|
|
19
619
|
```
|
|
620
|
+
|
|
621
|
+
### Help
|
|
622
|
+
|
|
623
|
+
#### Usage
|
|
624
|
+
|
|
625
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
626
|
+
|
|
627
|
+
```js
|
|
628
|
+
import { Help } from '@dhis2/ui'
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
#### Props
|
|
632
|
+
|
|
633
|
+
| Name | Type | Default | Required | Description |
|
|
634
|
+
| --------- | ------ | --------------------- | -------- | ----------- |
|
|
635
|
+
| children | string | | | |
|
|
636
|
+
| className | string | | | |
|
|
637
|
+
| dataTest | string | `'dhis2-uicore-help'` | | |
|
|
638
|
+
| error | custom | | | |
|
|
639
|
+
| valid | custom | | | |
|
|
640
|
+
| warning | custom | | | |
|
|
641
|
+
|
|
642
|
+
### Input
|
|
643
|
+
|
|
644
|
+
#### Usage
|
|
645
|
+
|
|
646
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
647
|
+
|
|
648
|
+
```js
|
|
649
|
+
import { Input } from '@dhis2/ui'
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
#### Props
|
|
653
|
+
|
|
654
|
+
| Name | Type | Default | Required | Description |
|
|
655
|
+
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
656
|
+
| autoComplete | string | | | The [native `autocomplete` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autocomplete) |
|
|
657
|
+
| className | string | | | |
|
|
658
|
+
| dataTest | string | `'dhis2-uicore-input'` | | |
|
|
659
|
+
| dense | boolean | | | Makes the input smaller |
|
|
660
|
+
| disabled | boolean | | | Disables the input |
|
|
661
|
+
| error | custom | | | Applies 'error' appearance for validation feedback. Mutually exclusive with `valid` and `warning` props |
|
|
662
|
+
| initialFocus | boolean | | | The input grabs initial focus on the page |
|
|
663
|
+
| loading | boolean | | | Adds a loading indicator beside the input |
|
|
664
|
+
| max | string | | | The [native `max` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-max), for use when `type` is `'number'` |
|
|
665
|
+
| min | string | | | The [native `min` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-min), for use when `type` is `'number'` |
|
|
666
|
+
| name | string | | | Name associated with the input. Passed to event handler callbacks in object |
|
|
667
|
+
| placeholder | string | | | Placeholder text for the input |
|
|
668
|
+
| readOnly | boolean | | | Makes the input read-only |
|
|
669
|
+
| role | string | | | Sets a role attribute on the input |
|
|
670
|
+
| step | string | | | The [native `step` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step), for use when `type` is `'number'` |
|
|
671
|
+
| tabIndex | string | | | |
|
|
672
|
+
| type | 'text' │ 'number' │ 'password' │ 'email' │ 'url' │ 'tel' │ 'date' │ 'datetime' │ 'datetime-local' │ 'month' │ 'week' │ 'time' │ 'search' | `'text'` | | The native input `type` attribute |
|
|
673
|
+
| valid | custom | | | Applies 'valid' appearance for validation feedback. Mutually exclusive with `error` and `warning` props |
|
|
674
|
+
| value | string | | | Value in the input. Can be used to control the component (recommended). Passed to event handler callbacks in object |
|
|
675
|
+
| warning | custom | | | Applies 'warning' appearance for validation feedback. Mutually exclusive with `valid` and `error` props |
|
|
676
|
+
| onBlur | function | | | Called with signature `({ name: string, value: string }, event)` |
|
|
677
|
+
| onChange | function | | | Called with signature `({ name: string, value: string }, event)` |
|
|
678
|
+
| onFocus | function | | | Called with signature `({ name: string, value: string }, event)` |
|
|
679
|
+
|
|
680
|
+
### InputField
|
|
681
|
+
|
|
682
|
+
#### Usage
|
|
683
|
+
|
|
684
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
685
|
+
|
|
686
|
+
```js
|
|
687
|
+
import { InputField } from '@dhis2/ui'
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
#### Props
|
|
691
|
+
|
|
692
|
+
| Name | Type | Default | Required | Description |
|
|
693
|
+
| -------------- | -------- | ------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
694
|
+
| autoComplete | string | | | The [native `autocomplete` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autocomplete) |
|
|
695
|
+
| className | string | | | |
|
|
696
|
+
| dataTest | string | `'dhis2-uiwidgets-inputfield'` | | |
|
|
697
|
+
| dense | boolean | | | Makes the input smaller |
|
|
698
|
+
| disabled | boolean | | | Disables the input |
|
|
699
|
+
| error | custom | | | Applies 'error' appearance for validation feedback. Mutually exclusive with `valid` and `warning` props |
|
|
700
|
+
| helpText | string | | | Guiding text for how to use this input |
|
|
701
|
+
| initialFocus | boolean | | | The input grabs initial focus on the page |
|
|
702
|
+
| inputWidth | string | | | Defines the width of the input. Can be any valid CSS measurement |
|
|
703
|
+
| label | string | | | Label text for the input |
|
|
704
|
+
| loading | boolean | | | Adds a loading indicator beside the input |
|
|
705
|
+
| max | string | | | The [native `max` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-max), for use when `type` is `'number'` |
|
|
706
|
+
| min | string | | | The [native `min` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-min), for use when `type` is `'number'` |
|
|
707
|
+
| name | string | | | Name associated with the input. Passed to event handler callbacks in object |
|
|
708
|
+
| placeholder | string | | | Placeholder text for the input |
|
|
709
|
+
| readOnly | boolean | | | Makes the input read-only |
|
|
710
|
+
| required | boolean | | | Indicates this input is required |
|
|
711
|
+
| step | string | | | The [native `step` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-step), for use when `type` is `'number'` |
|
|
712
|
+
| tabIndex | string | | | |
|
|
713
|
+
| type | custom | | | Type of input |
|
|
714
|
+
| valid | custom | | | Applies 'valid' appearance for validation feedback. Mutually exclusive with `error` and `warning` props |
|
|
715
|
+
| validationText | string | | | Text below input for validation feedback. Receives styles depending on validation status |
|
|
716
|
+
| value | string | | | Value in the input. Can be used to control the component (recommended). Passed to event handler callbacks in object |
|
|
717
|
+
| warning | custom | | | Applies 'warning' appearance for validation feedback. Mutually exclusive with `valid` and `error` props |
|
|
718
|
+
| onBlur | function | | | Called with signature `({ name: string, value: string }, event)` |
|
|
719
|
+
| onChange | function | | | Called with signature `({ name: string, value: string }, event)` |
|
|
720
|
+
| onFocus | function | | | Called with signature `({ name: string, value: string }, event)` |
|
|
721
|
+
|
|
722
|
+
### IntersectionDetector
|
|
723
|
+
|
|
724
|
+
#### Usage
|
|
725
|
+
|
|
726
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
727
|
+
|
|
728
|
+
```js
|
|
729
|
+
import { IntersectionDetector } from '@dhis2/ui'
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
#### Props
|
|
733
|
+
|
|
734
|
+
| Name | Type | Default | Required | Description |
|
|
735
|
+
| --------- | ------------------------------------------------- | ------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
736
|
+
| rootRef | {<br/> "current": "instanceOf(HTMLElement)"<br/>} | | \* | React ref on other component to detect intersections with |
|
|
737
|
+
| onChange | function | | \* | Called with signature `({ isIntersecting: bool })` |
|
|
738
|
+
| children | any | | | |
|
|
739
|
+
| className | string | | | |
|
|
740
|
+
| dataTest | string | `'dhis2-uicore-intersectiondetector'` | | |
|
|
741
|
+
| threshold | number | `0` | | The [threshold](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#Intersection_observer_options) value: a value from 0.0 to 1.0 that controls the point at which an intersecting component is considered 'intersected' or 'visible' and the onChange callback triggers |
|
|
742
|
+
|
|
743
|
+
### Label
|
|
744
|
+
|
|
745
|
+
#### Usage
|
|
746
|
+
|
|
747
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
748
|
+
|
|
749
|
+
```js
|
|
750
|
+
import { Label } from '@dhis2/ui'
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
#### Props
|
|
754
|
+
|
|
755
|
+
| Name | Type | Default | Required | Description |
|
|
756
|
+
| --------- | ------- | ---------------------- | -------- | ----------- |
|
|
757
|
+
| children | string | | | |
|
|
758
|
+
| className | string | | | |
|
|
759
|
+
| dataTest | string | `'dhis2-uicore-label'` | | |
|
|
760
|
+
| disabled | boolean | | | |
|
|
761
|
+
| htmlFor | string | | | |
|
|
762
|
+
| required | boolean | | | |
|
|
763
|
+
|
|
764
|
+
### Layer
|
|
765
|
+
|
|
766
|
+
#### Usage
|
|
767
|
+
|
|
768
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
769
|
+
|
|
770
|
+
```js
|
|
771
|
+
import { Layer } from '@dhis2/ui'
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
#### Props
|
|
775
|
+
|
|
776
|
+
| Name | Type | Default | Required | Description |
|
|
777
|
+
| ------------- | -------------------- | ---------------------- | -------- | --------------------------------------------- |
|
|
778
|
+
| children | node | | | |
|
|
779
|
+
| className | string | | | |
|
|
780
|
+
| dataTest | string | `'dhis2-uicore-layer'` | | |
|
|
781
|
+
| disablePortal | boolean | | | Disable the Portal, useful for nesting layers |
|
|
782
|
+
| level | number │ string | `'auto'` | | Z-index level |
|
|
783
|
+
| position | 'absolute' │ 'fixed' | `'fixed'` | | |
|
|
784
|
+
| translucent | boolean | | | Adds a semi-transparent background |
|
|
785
|
+
| onClick | function | | | Click handler |
|
|
786
|
+
|
|
787
|
+
### Legend
|
|
788
|
+
|
|
789
|
+
#### Usage
|
|
790
|
+
|
|
791
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
792
|
+
|
|
793
|
+
```js
|
|
794
|
+
import { Legend } from '@dhis2/ui'
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
#### Props
|
|
798
|
+
|
|
799
|
+
| Name | Type | Default | Required | Description |
|
|
800
|
+
| --------- | ------- | ----------------------- | -------- | ---------------------------------------------- |
|
|
801
|
+
| children | node | | | |
|
|
802
|
+
| className | string | | | |
|
|
803
|
+
| dataTest | string | `'dhis2-uicore-legend'` | | |
|
|
804
|
+
| required | boolean | | | Indicates the associated field set is required |
|
|
805
|
+
|
|
806
|
+
### CircularLoader
|
|
807
|
+
|
|
808
|
+
#### Usage
|
|
809
|
+
|
|
810
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
811
|
+
|
|
812
|
+
```js
|
|
813
|
+
import { CircularLoader } from '@dhis2/ui'
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
#### Props
|
|
817
|
+
|
|
818
|
+
| Name | Type | Default | Required | Description |
|
|
819
|
+
| ---------- | ------- | ------------------------------- | -------- | ----------- |
|
|
820
|
+
| className | string | | | |
|
|
821
|
+
| dataTest | string | `'dhis2-uicore-circularloader'` | | |
|
|
822
|
+
| extrasmall | custom | | | |
|
|
823
|
+
| invert | boolean | | | |
|
|
824
|
+
| large | custom | | | |
|
|
825
|
+
| small | custom | | | |
|
|
826
|
+
|
|
827
|
+
### LinearLoader
|
|
828
|
+
|
|
829
|
+
#### Usage
|
|
830
|
+
|
|
831
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
832
|
+
|
|
833
|
+
```js
|
|
834
|
+
import { LinearLoader } from '@dhis2/ui'
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
#### Props
|
|
838
|
+
|
|
839
|
+
| Name | Type | Default | Required | Description |
|
|
840
|
+
| --------- | ------- | ----------------------------- | -------- | ----------------------------------------------------- |
|
|
841
|
+
| amount | number | | \* | The progression in percent without the '%' sign |
|
|
842
|
+
| className | string | | | |
|
|
843
|
+
| dataTest | string | `'dhis2-uicore-linearloader'` | | |
|
|
844
|
+
| invert | boolean | | | Use inverted color scheme |
|
|
845
|
+
| margin | string | `spacers.dp12` | | The margin around the loader, can be a full shorthand |
|
|
846
|
+
| width | string | `'300px'` | | The width of the entire indicator |
|
|
847
|
+
|
|
848
|
+
### LogoIcon
|
|
849
|
+
|
|
850
|
+
#### Usage
|
|
851
|
+
|
|
852
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
853
|
+
|
|
854
|
+
```js
|
|
855
|
+
import { LogoIcon } from '@dhis2/ui'
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
#### Props
|
|
859
|
+
|
|
860
|
+
| Name | Type | Default | Required | Description |
|
|
861
|
+
| --------- | ------ | ------------------------- | -------- | ----------- |
|
|
862
|
+
| className | string | | | |
|
|
863
|
+
| dataTest | string | `'dhis2-uicore-logoicon'` | | |
|
|
864
|
+
|
|
865
|
+
### LogoIconWhite
|
|
866
|
+
|
|
867
|
+
#### Usage
|
|
868
|
+
|
|
869
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
870
|
+
|
|
871
|
+
```js
|
|
872
|
+
import { LogoIconWhite } from '@dhis2/ui'
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
#### Props
|
|
876
|
+
|
|
877
|
+
| Name | Type | Default | Required | Description |
|
|
878
|
+
| --------- | ------ | ------------------------------ | -------- | ----------- |
|
|
879
|
+
| className | string | | | |
|
|
880
|
+
| dataTest | string | `'dhis2-uicore-logoiconwhite'` | | |
|
|
881
|
+
|
|
882
|
+
### Logo
|
|
883
|
+
|
|
884
|
+
#### Usage
|
|
885
|
+
|
|
886
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
887
|
+
|
|
888
|
+
```js
|
|
889
|
+
import { Logo } from '@dhis2/ui'
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
#### Props
|
|
893
|
+
|
|
894
|
+
| Name | Type | Default | Required | Description |
|
|
895
|
+
| --------- | ------ | --------------------- | -------- | ----------- |
|
|
896
|
+
| className | string | | | |
|
|
897
|
+
| dataTest | string | `'dhis2-uicore-logo'` | | |
|
|
898
|
+
|
|
899
|
+
### LogoWhite
|
|
900
|
+
|
|
901
|
+
#### Usage
|
|
902
|
+
|
|
903
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
904
|
+
|
|
905
|
+
```js
|
|
906
|
+
import { LogoWhite } from '@dhis2/ui'
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
#### Props
|
|
910
|
+
|
|
911
|
+
| Name | Type | Default | Required | Description |
|
|
912
|
+
| --------- | ------ | -------------------------- | -------- | ----------- |
|
|
913
|
+
| className | string | | | |
|
|
914
|
+
| dataTest | string | `'dhis2-uicore-logowhite'` | | |
|
|
915
|
+
|
|
916
|
+
### FlyoutMenu
|
|
917
|
+
|
|
918
|
+
#### Usage
|
|
919
|
+
|
|
920
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
921
|
+
|
|
922
|
+
```js
|
|
923
|
+
import { FlyoutMenu } from '@dhis2/ui'
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
#### Props
|
|
927
|
+
|
|
928
|
+
| Name | Type | Default | Required | Description |
|
|
929
|
+
| --------- | ------- | --------------------- | -------- | ---------------------------------------------------- |
|
|
930
|
+
| children | node | | | Typically, but not limited to, `MenuItem` components |
|
|
931
|
+
| className | string | | | |
|
|
932
|
+
| dataTest | string | `'dhis2-uicore-menu'` | | |
|
|
933
|
+
| dense | boolean | | | Menu uses smaller dimensions |
|
|
934
|
+
| maxHeight | string | `'auto'` | | |
|
|
935
|
+
| maxWidth | string | `'380px'` | | |
|
|
936
|
+
|
|
937
|
+
### Menu
|
|
938
|
+
|
|
939
|
+
#### Usage
|
|
940
|
+
|
|
941
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
942
|
+
|
|
943
|
+
```js
|
|
944
|
+
import { Menu } from '@dhis2/ui'
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
#### Props
|
|
948
|
+
|
|
949
|
+
| Name | Type | Default | Required | Description |
|
|
950
|
+
| --------- | ------- | ------------------------- | -------- | ------------------------------------------------------------------------- |
|
|
951
|
+
| children | node | | | Typically `MenuItem`, `MenuDivider`, and `MenuSectionHeader` |
|
|
952
|
+
| className | string | | | |
|
|
953
|
+
| dataTest | string | `'dhis2-uicore-menulist'` | | |
|
|
954
|
+
| dense | boolean | | | Applies `dense` property to all child components unless already specified |
|
|
955
|
+
|
|
956
|
+
### MenuDivider
|
|
957
|
+
|
|
958
|
+
#### Usage
|
|
959
|
+
|
|
960
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
961
|
+
|
|
962
|
+
```js
|
|
963
|
+
import { MenuDivider } from '@dhis2/ui'
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
#### Props
|
|
967
|
+
|
|
968
|
+
| Name | Type | Default | Required | Description |
|
|
969
|
+
| --------- | ------- | ---------------------------- | -------- | ----------- |
|
|
970
|
+
| className | string | | | |
|
|
971
|
+
| dataTest | string | `'dhis2-uicore-menudivider'` | | |
|
|
972
|
+
| dense | boolean | | | |
|
|
973
|
+
|
|
974
|
+
### MenuItem
|
|
975
|
+
|
|
976
|
+
#### Usage
|
|
977
|
+
|
|
978
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
979
|
+
|
|
980
|
+
```js
|
|
981
|
+
import { MenuItem } from '@dhis2/ui'
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
#### Props
|
|
985
|
+
|
|
986
|
+
| Name | Type | Default | Required | Description |
|
|
987
|
+
| ------------- | -------- | ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------- |
|
|
988
|
+
| active | boolean | | | |
|
|
989
|
+
| chevron | boolean | | | |
|
|
990
|
+
| children | node | | | Nested menu items can become submenus.<br/>See `showSubMenu` and `toggleSubMenu` props, and 'Children' demo |
|
|
991
|
+
| className | string | | | |
|
|
992
|
+
| dataTest | string | `'dhis2-uicore-menuitem'` | | |
|
|
993
|
+
| dense | boolean | | | |
|
|
994
|
+
| destructive | boolean | | | |
|
|
995
|
+
| disabled | boolean | | | |
|
|
996
|
+
| href | string | | | For using menu item as a link |
|
|
997
|
+
| icon | node | | | An icon for the left side of the menu item |
|
|
998
|
+
| label | node | | | Text in the menu item |
|
|
999
|
+
| showSubMenu | boolean | | | When true, nested menu items are shown in a Popper |
|
|
1000
|
+
| target | string | | | For using menu item as a link |
|
|
1001
|
+
| toggleSubMenu | function | | | On click, this function is called (without args) |
|
|
1002
|
+
| value | string | | | Value associated with item. Passed as an argument to onClick handler. |
|
|
1003
|
+
| onClick | function | | | Click handler called with signature `({ value: string }, event)` |
|
|
1004
|
+
|
|
1005
|
+
### MenuSectionHeader
|
|
1006
|
+
|
|
1007
|
+
#### Usage
|
|
1008
|
+
|
|
1009
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1010
|
+
|
|
1011
|
+
```js
|
|
1012
|
+
import { MenuSectionHeader } from '@dhis2/ui'
|
|
1013
|
+
```
|
|
1014
|
+
|
|
1015
|
+
#### Props
|
|
1016
|
+
|
|
1017
|
+
| Name | Type | Default | Required | Description |
|
|
1018
|
+
| ----------- | ------- | ---------------------------------- | -------- | ----------- |
|
|
1019
|
+
| className | string | | | |
|
|
1020
|
+
| dataTest | string | `'dhis2-uicore-menusectionheader'` | | |
|
|
1021
|
+
| dense | boolean | | | |
|
|
1022
|
+
| hideDivider | boolean | | | |
|
|
1023
|
+
| label | node | | | |
|
|
1024
|
+
|
|
1025
|
+
### Modal
|
|
1026
|
+
|
|
1027
|
+
#### Usage
|
|
1028
|
+
|
|
1029
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1030
|
+
|
|
1031
|
+
```js
|
|
1032
|
+
import { Modal } from '@dhis2/ui'
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
#### Props
|
|
1036
|
+
|
|
1037
|
+
| Name | Type | Default | Required | Description |
|
|
1038
|
+
| --------- | -------- | ---------------------- | -------- | ----------------------------------- |
|
|
1039
|
+
| children | node | | | |
|
|
1040
|
+
| className | string | | | |
|
|
1041
|
+
| dataTest | string | `'dhis2-uicore-modal'` | | |
|
|
1042
|
+
| fluid | boolean | | | |
|
|
1043
|
+
| hide | boolean | | | |
|
|
1044
|
+
| large | custom | | | |
|
|
1045
|
+
| position | custom | `'top'` | | |
|
|
1046
|
+
| small | custom | | | |
|
|
1047
|
+
| onClose | function | | | Callback used when the Modal closes |
|
|
1048
|
+
|
|
1049
|
+
### ModalActions
|
|
1050
|
+
|
|
1051
|
+
#### Usage
|
|
1052
|
+
|
|
1053
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1054
|
+
|
|
1055
|
+
```js
|
|
1056
|
+
import { ModalActions } from '@dhis2/ui'
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
#### Props
|
|
1060
|
+
|
|
1061
|
+
| Name | Type | Default | Required | Description |
|
|
1062
|
+
| -------- | ------ | ----------------------------- | -------- | ----------- |
|
|
1063
|
+
| children | node | | | |
|
|
1064
|
+
| dataTest | string | `'dhis2-uicore-modalactions'` | | |
|
|
1065
|
+
|
|
1066
|
+
### ModalContent
|
|
1067
|
+
|
|
1068
|
+
#### Usage
|
|
1069
|
+
|
|
1070
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1071
|
+
|
|
1072
|
+
```js
|
|
1073
|
+
import { ModalContent } from '@dhis2/ui'
|
|
1074
|
+
```
|
|
1075
|
+
|
|
1076
|
+
#### Props
|
|
1077
|
+
|
|
1078
|
+
| Name | Type | Default | Required | Description |
|
|
1079
|
+
| --------- | ------ | ----------------------------- | -------- | ----------- |
|
|
1080
|
+
| children | node | | | |
|
|
1081
|
+
| className | string | | | |
|
|
1082
|
+
| dataTest | string | `'dhis2-uicore-modalcontent'` | | |
|
|
1083
|
+
|
|
1084
|
+
### ModalTitle
|
|
1085
|
+
|
|
1086
|
+
#### Usage
|
|
1087
|
+
|
|
1088
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1089
|
+
|
|
1090
|
+
```js
|
|
1091
|
+
import { ModalTitle } from '@dhis2/ui'
|
|
1092
|
+
```
|
|
1093
|
+
|
|
1094
|
+
#### Props
|
|
1095
|
+
|
|
1096
|
+
| Name | Type | Default | Required | Description |
|
|
1097
|
+
| -------- | ------ | --------------------------- | -------- | ----------- |
|
|
1098
|
+
| children | string | | | |
|
|
1099
|
+
| dataTest | string | `'dhis2-uicore-modaltitle'` | | |
|
|
1100
|
+
|
|
1101
|
+
### Node
|
|
1102
|
+
|
|
1103
|
+
#### Usage
|
|
1104
|
+
|
|
1105
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1106
|
+
|
|
1107
|
+
```js
|
|
1108
|
+
import { Node } from '@dhis2/ui'
|
|
1109
|
+
```
|
|
1110
|
+
|
|
1111
|
+
#### Props
|
|
1112
|
+
|
|
1113
|
+
| Name | Type | Default | Required | Description |
|
|
1114
|
+
| --------- | -------- | --------------------- | -------- | ----------------------------------------------------------------------------------------- |
|
|
1115
|
+
| children | node | | | Content below this level of the hierarchy; children are revealed when this leaf is 'open' |
|
|
1116
|
+
| className | string | | | |
|
|
1117
|
+
| component | element | | | Content/label for this leaf, for example a checkbox |
|
|
1118
|
+
| dataTest | string | `'dhis2-uicore-node'` | | |
|
|
1119
|
+
| icon | node | | | A custom icon to use instead of a toggle arrow |
|
|
1120
|
+
| open | boolean | | | |
|
|
1121
|
+
| onClose | function | | | |
|
|
1122
|
+
| onOpen | function | | | |
|
|
1123
|
+
|
|
1124
|
+
### NoticeBox
|
|
1125
|
+
|
|
1126
|
+
#### Usage
|
|
1127
|
+
|
|
1128
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1129
|
+
|
|
1130
|
+
```js
|
|
1131
|
+
import { NoticeBox } from '@dhis2/ui'
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
#### Props
|
|
1135
|
+
|
|
1136
|
+
| Name | Type | Default | Required | Description |
|
|
1137
|
+
| --------- | ------ | -------------------------- | -------- | -------------------------------------------------------------------------- |
|
|
1138
|
+
| children | node | | | |
|
|
1139
|
+
| className | string | | | |
|
|
1140
|
+
| dataTest | string | `'dhis2-uicore-noticebox'` | | |
|
|
1141
|
+
| error | custom | | | Applies 'error' message styles. Mutually exclusive with the `warning` prop |
|
|
1142
|
+
| title | string | | | |
|
|
1143
|
+
| warning | custom | | | Applies 'warning' message styles. Mutually exclusive with the `error` prop |
|
|
1144
|
+
|
|
1145
|
+
### OrganisationUnitTree
|
|
1146
|
+
|
|
1147
|
+
#### Usage
|
|
1148
|
+
|
|
1149
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1150
|
+
|
|
1151
|
+
```js
|
|
1152
|
+
import { OrganisationUnitTree } from '@dhis2/ui'
|
|
1153
|
+
```
|
|
1154
|
+
|
|
1155
|
+
#### Props
|
|
1156
|
+
|
|
1157
|
+
| Name | Type | Default | Required | Description |
|
|
1158
|
+
| --------------------------- | ------------------------ | ------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1159
|
+
| roots | string │ arrayOf(string) | | \* | Root org unit ID(s) |
|
|
1160
|
+
| onChange | function | | \* | Will be called with the following object:<br/>`{ id: string, displayName: string, path: string, checked: boolean, selected: string[] }` |
|
|
1161
|
+
| autoExpandLoadingError | boolean | | | When set, the error when loading children fails will be shown automatically |
|
|
1162
|
+
| dataTest | string | `'dhis2-uiwidgets-orgunittree'` | | |
|
|
1163
|
+
| disableSelection | boolean | | | When set to true, no unit can be selected |
|
|
1164
|
+
| expanded | custom | | | |
|
|
1165
|
+
| filter | arrayOf(custom) | `[]` | | All organisation units with a path that includes the provided paths will be shown.<br/>All others will not be rendered. When not provided, all org units will be shown. |
|
|
1166
|
+
| forceReload | boolean | | | When true, everything will be reloaded. In order to load it again after reloading, `forceReload` has to be set to `false` and then to `true` again |
|
|
1167
|
+
| handleCollapse | custom | | | |
|
|
1168
|
+
| handleExpand | custom | | | |
|
|
1169
|
+
| highlighted | arrayOf(custom) | `[]` | | All units provided to "highlighted" as path will be visually<br/>highlighted.<br/>Note:<br/>The d2-ui component used two props for this:<br/>_ searchResults<br/>_ highlightSearchResults |
|
|
1170
|
+
| initiallyExpanded | arrayOf(custom) | `[]` | | An array of OU paths that will be expanded automatically<br/>as soon as they are encountered.<br/>The path of an OU is the UIDs of the OU<br/>and all its parent OUs separated by slashes (/)<br/>Note: This replaces "openFirstLevel" as that's redundant |
|
|
1171
|
+
| isUserDataViewFallback | boolean | | | When provided, the 'isUserDataViewFallback' option will be sent when requesting the org units |
|
|
1172
|
+
| renderNodeLabel | function | `defaultRenderNodeLabel` | | Renders the actual node component for each leaf, can be used to<br/>customize the node. The default function just returns the node's<br/>displayName<br/><br/>Shape of the object passed to the callback:<br/>`` <br/>{<br/> label: string,<br/> node: {<br/> displayName: string,<br/> id: string,<br/> // Only provided once `loading` is false<br/> path?: string,<br/> // Only provided once `loading` is false<br/> children?: Array.<{<br/> id: string,<br/> path: string,<br/> displayName: string<br/> }><br/> },<br/> loading: boolean,<br/> error: string,<br/> open: boolean,<br/> selected: string[],<br/> singleSelection: boolean,<br/> disableSelection: boolean,<br/>}<br/> `` |
|
|
1173
|
+
| selected | arrayOf(custom) | `[]` | | An array of paths of selected OUs. The path of an OU is the UIDs of the OU and all its parent OUs separated by slashes (`/`) |
|
|
1174
|
+
| singleSelection | boolean | | | When set, no checkboxes will be displayed and only the first selected path in `selected` will be highlighted |
|
|
1175
|
+
| suppressAlphabeticalSorting | boolean | | | Turns off alphabetical sorting of units |
|
|
1176
|
+
| onChildrenLoaded | function | | | Called with the children's data that was loaded |
|
|
1177
|
+
| onCollapse | function | | | Called with `{ path: string }` with the path of the parent of the level closed |
|
|
1178
|
+
| onExpand | function | | | Called with `{ path: string }` with the path of the parent of the level opened |
|
|
1179
|
+
|
|
1180
|
+
### Label
|
|
1181
|
+
|
|
1182
|
+
#### Usage
|
|
1183
|
+
|
|
1184
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1185
|
+
|
|
1186
|
+
```js
|
|
1187
|
+
import { Label } from '@dhis2/ui'
|
|
1188
|
+
```
|
|
1189
|
+
|
|
1190
|
+
#### Props
|
|
1191
|
+
|
|
1192
|
+
| Name | Type | Default | Required | Description |
|
|
1193
|
+
| ---------------------- | ----------------------------------------------------------------------------------------------------------- | ------- | -------- | ----------- |
|
|
1194
|
+
| children | any | | \* | |
|
|
1195
|
+
| dataTest | string | | \* | |
|
|
1196
|
+
| fullPath | string | | \* | |
|
|
1197
|
+
| hasChildren | boolean | | \* | |
|
|
1198
|
+
| loading | boolean | | \* | |
|
|
1199
|
+
| node | {<br/> "displayName": "string",<br/> "id": "string",<br/> "children": "number",<br/> "path": "string"<br/>} | | \* | |
|
|
1200
|
+
| open | boolean | | \* | |
|
|
1201
|
+
| rootId | string | | \* | |
|
|
1202
|
+
| onChange | function | | \* | |
|
|
1203
|
+
| onToggleOpen | function | | \* | |
|
|
1204
|
+
| checked | boolean | | | |
|
|
1205
|
+
| disableSelection | boolean | | | |
|
|
1206
|
+
| hasSelectedDescendants | boolean | | | |
|
|
1207
|
+
| highlighted | boolean | | | |
|
|
1208
|
+
| selected | arrayOf(custom) | | | |
|
|
1209
|
+
| singleSelection | boolean | | | |
|
|
1210
|
+
|
|
1211
|
+
### Pagination
|
|
1212
|
+
|
|
1213
|
+
#### Usage
|
|
1214
|
+
|
|
1215
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1216
|
+
|
|
1217
|
+
```js
|
|
1218
|
+
import { Pagination } from '@dhis2/ui'
|
|
1219
|
+
```
|
|
1220
|
+
|
|
1221
|
+
#### Props
|
|
1222
|
+
|
|
1223
|
+
| Name | Type | Default | Required | Description |
|
|
1224
|
+
| ------------------ | ----------------- | -------------------------------------------------- | -------- | ----------- |
|
|
1225
|
+
| page | number | | \* | |
|
|
1226
|
+
| pageSize | number | | \* | |
|
|
1227
|
+
| className | string | | | |
|
|
1228
|
+
| dataTest | string | `'dhis2-uiwidgets-pagination'` | | |
|
|
1229
|
+
| disabled | boolean | | | |
|
|
1230
|
+
| hidePageSelect | boolean | | | |
|
|
1231
|
+
| hidePageSizeSelect | boolean | | | |
|
|
1232
|
+
| hidePageSummary | boolean | | | |
|
|
1233
|
+
| isLastPage | boolean | | | |
|
|
1234
|
+
| nextPageText | string │ function | `() => i18n.t('Next')` | | |
|
|
1235
|
+
| pageCount | number | | | |
|
|
1236
|
+
| pageLength | custom | | | |
|
|
1237
|
+
| pageSelectText | string │ function | `() => i18n.t('Page')` | | |
|
|
1238
|
+
| pageSizeSelectText | string │ function | `() => i18n.t('Items per page')` | | |
|
|
1239
|
+
| pageSizes | arrayOf(string) | `['5', '10', '20', '30', '40', '50', '75', '100']` | | |
|
|
1240
|
+
| pageSummaryText | string │ function | `getDefaultPageSummaryText` | | |
|
|
1241
|
+
| previousPageText | string │ function | `() => i18n.t('Previous')` | | |
|
|
1242
|
+
| total | number | | | |
|
|
1243
|
+
| onPageChange | function | | | |
|
|
1244
|
+
| onPageSizeChange | function | | | |
|
|
1245
|
+
|
|
1246
|
+
### Popover
|
|
1247
|
+
|
|
1248
|
+
#### Usage
|
|
1249
|
+
|
|
1250
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1251
|
+
|
|
1252
|
+
```js
|
|
1253
|
+
import { Popover } from '@dhis2/ui'
|
|
1254
|
+
```
|
|
1255
|
+
|
|
1256
|
+
#### Props
|
|
1257
|
+
|
|
1258
|
+
| Name | Type | Default | Required | Description |
|
|
1259
|
+
| ---------------------- | -------- | ------------------------ | -------- | --------------------------------------------------------------------------------------------- |
|
|
1260
|
+
| children | node | | \* | |
|
|
1261
|
+
| arrow | boolean | `true` | | Show or hide the arrow |
|
|
1262
|
+
| className | string | | | |
|
|
1263
|
+
| dataTest | string | `'dhis2-uicore-popover'` | | |
|
|
1264
|
+
| elevation | string | `elevations.e200` | | Box-shadow to create appearance of elevation. Use `elevations` constants from the UI library. |
|
|
1265
|
+
| maxWidth | number | `360` | | |
|
|
1266
|
+
| observePopperResize | boolean | | | |
|
|
1267
|
+
| observeReferenceResize | boolean | | | |
|
|
1268
|
+
| placement | custom | `'top'` | | |
|
|
1269
|
+
| reference | custom | | | A React ref that refers to the element the Popover should position against |
|
|
1270
|
+
| onClickOutside | function | | | |
|
|
1271
|
+
|
|
1272
|
+
### Popper
|
|
1273
|
+
|
|
1274
|
+
#### Usage
|
|
1275
|
+
|
|
1276
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1277
|
+
|
|
1278
|
+
```js
|
|
1279
|
+
import { Popper } from '@dhis2/ui'
|
|
1280
|
+
```
|
|
1281
|
+
|
|
1282
|
+
#### Props
|
|
1283
|
+
|
|
1284
|
+
| Name | Type | Default | Required | Description |
|
|
1285
|
+
| ---------------------- | ---------------------------------------------------------------- | ----------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1286
|
+
| children | node | | \* | Content inside the Popper |
|
|
1287
|
+
| className | string | | | |
|
|
1288
|
+
| dataTest | string | `'dhis2-uicore-popper'` | | |
|
|
1289
|
+
| modifiers | arrayOf({<br/> "name": "string",<br/> "options": "object"<br/>}) | `[]` | | A property of the `createPopper` options. See [popper docs](https://popper.js.org/docs/v2/constructors/) |
|
|
1290
|
+
| observePopperResize | boolean | | | Makes the Popper update position when the **Popper content** changes size |
|
|
1291
|
+
| observeReferenceResize | boolean | | | Makes the Popper update position when the **reference element** changes size |
|
|
1292
|
+
| placement | custom | `'auto'` | | A property of the `createPopper` options. See [popper docs](https://popper.js.org/docs/v2/constructors/) |
|
|
1293
|
+
| reference | custom | | | A React ref, DOM node, or [virtual element](https://popper.js.org/docs/v2/virtual-elements/) for the popper to position itself against |
|
|
1294
|
+
| strategy | 'absolute' │ 'fixed' | | | A property of the `createPopper` options. See [popper docs](https://popper.js.org/docs/v2/constructors/) |
|
|
1295
|
+
| onFirstUpdate | function | | | A property of the `createPopper` options. See [popper docs](https://popper.js.org/docs/v2/constructors/) |
|
|
1296
|
+
|
|
1297
|
+
### Radio
|
|
1298
|
+
|
|
1299
|
+
#### Usage
|
|
1300
|
+
|
|
1301
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1302
|
+
|
|
1303
|
+
```js
|
|
1304
|
+
import { Radio } from '@dhis2/ui'
|
|
1305
|
+
```
|
|
1306
|
+
|
|
1307
|
+
#### Props
|
|
1308
|
+
|
|
1309
|
+
| Name | Type | Default | Required | Description |
|
|
1310
|
+
| ------------ | -------- | ---------------------- | -------- | -------------------------------------------------------------------------------------- |
|
|
1311
|
+
| checked | boolean | | | |
|
|
1312
|
+
| className | string | | | |
|
|
1313
|
+
| dataTest | string | `'dhis2-uicore-radio'` | | |
|
|
1314
|
+
| dense | boolean | | | |
|
|
1315
|
+
| disabled | boolean | | | |
|
|
1316
|
+
| error | custom | | | Adds 'error' styling for feedback. Mutually exclusive with `valid` and `warning` props |
|
|
1317
|
+
| initialFocus | boolean | | | |
|
|
1318
|
+
| label | node | | | |
|
|
1319
|
+
| name | string | | | Name associated with this element. Passed in object to event handler functions |
|
|
1320
|
+
| tabIndex | string | | | |
|
|
1321
|
+
| valid | custom | | | Adds 'valid' styling for feedback. Mutually exclusive with `error` and `warning` props |
|
|
1322
|
+
| value | string | | | Value associated with this element. Passed in object to event handler functions |
|
|
1323
|
+
| warning | custom | | | Adds 'warning' styling for feedback. Mutually exclusive with `valid` and `error` props |
|
|
1324
|
+
| onBlur | function | | | Called with the signature `({ name: string, value: string, checked: bool }, event)` |
|
|
1325
|
+
| onChange | function | | | Called with the signature `({ name: string, value: string, checked: bool }, event)` |
|
|
1326
|
+
| onFocus | function | | | Called with the signature `({ name: string, value: string, checked: bool }, event)` |
|
|
1327
|
+
|
|
1328
|
+
### Required
|
|
1329
|
+
|
|
1330
|
+
#### Usage
|
|
1331
|
+
|
|
1332
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1333
|
+
|
|
1334
|
+
```js
|
|
1335
|
+
import { Required } from '@dhis2/ui'
|
|
1336
|
+
```
|
|
1337
|
+
|
|
1338
|
+
#### Props
|
|
1339
|
+
|
|
1340
|
+
| Name | Type | Default | Required | Description |
|
|
1341
|
+
| -------- | ------ | ------- | -------- | ----------- |
|
|
1342
|
+
| dataTest | string | | \* | |
|
|
1343
|
+
|
|
1344
|
+
### SegmentedControl
|
|
1345
|
+
|
|
1346
|
+
#### Usage
|
|
1347
|
+
|
|
1348
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1349
|
+
|
|
1350
|
+
```js
|
|
1351
|
+
import { SegmentedControl } from '@dhis2/ui'
|
|
1352
|
+
```
|
|
1353
|
+
|
|
1354
|
+
#### Props
|
|
1355
|
+
|
|
1356
|
+
| Name | Type | Default | Required | Description |
|
|
1357
|
+
| -------- | ------------------------------------------------------------------------------------------- | ------- | -------- | ----------------------------------------------------------------------------------- |
|
|
1358
|
+
| options | arrayOf({<br/> "label": "string",<br/> "value": "string",<br/> "disabled": "boolean"<br/>}) | | \* | Options to populate the segmented control |
|
|
1359
|
+
| selected | string | | \* | An option to select; should match the `value` property of the option to be selected |
|
|
1360
|
+
| onChange | function | | \* | Called with the signature `({ value: string }, event)` |
|
|
1361
|
+
|
|
1362
|
+
### Input
|
|
1363
|
+
|
|
1364
|
+
#### Usage
|
|
1365
|
+
|
|
1366
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1367
|
+
|
|
1368
|
+
```js
|
|
1369
|
+
import { Input } from '@dhis2/ui'
|
|
1370
|
+
```
|
|
1371
|
+
|
|
1372
|
+
#### Props
|
|
1373
|
+
|
|
1374
|
+
| Name | Type | Default | Required | Description |
|
|
1375
|
+
| -------------- | --------------- | --------- | -------- | ----------- |
|
|
1376
|
+
| dataTest | string | | \* | |
|
|
1377
|
+
| className | string | | | |
|
|
1378
|
+
| clearText | custom | | | |
|
|
1379
|
+
| clearable | boolean | | | |
|
|
1380
|
+
| disabled | boolean | | | |
|
|
1381
|
+
| inputMaxHeight | string | `'100px'` | | |
|
|
1382
|
+
| options | node | | | |
|
|
1383
|
+
| placeholder | string | | | |
|
|
1384
|
+
| prefix | string | | | |
|
|
1385
|
+
| selected | arrayOf(string) | | | |
|
|
1386
|
+
| onChange | function | | | |
|
|
1387
|
+
|
|
1388
|
+
### Menu
|
|
1389
|
+
|
|
1390
|
+
#### Usage
|
|
1391
|
+
|
|
1392
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1393
|
+
|
|
1394
|
+
```js
|
|
1395
|
+
import { Menu } from '@dhis2/ui'
|
|
1396
|
+
```
|
|
1397
|
+
|
|
1398
|
+
#### Props
|
|
1399
|
+
|
|
1400
|
+
| Name | Type | Default | Required | Description |
|
|
1401
|
+
| -------- | --------------- | ------- | -------- | ----------- |
|
|
1402
|
+
| dataTest | string | | \* | |
|
|
1403
|
+
| empty | node | `''` | | |
|
|
1404
|
+
| options | node | | | |
|
|
1405
|
+
| selected | arrayOf(string) | | | |
|
|
1406
|
+
| onChange | function | | | |
|
|
1407
|
+
|
|
1408
|
+
### MultiSelect
|
|
1409
|
+
|
|
1410
|
+
#### Usage
|
|
1411
|
+
|
|
1412
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1413
|
+
|
|
1414
|
+
```js
|
|
1415
|
+
import { MultiSelect } from '@dhis2/ui'
|
|
1416
|
+
```
|
|
1417
|
+
|
|
1418
|
+
#### Props
|
|
1419
|
+
|
|
1420
|
+
| Name | Type | Default | Required | Description |
|
|
1421
|
+
| ----------------- | --------------- | ---------------------------- | -------- | --------------------------------------- |
|
|
1422
|
+
| children | node | | | |
|
|
1423
|
+
| className | string | | | |
|
|
1424
|
+
| clearText | custom | | | Required if `clearable` prop is `true` |
|
|
1425
|
+
| clearable | boolean | | | Adds a 'clear' option to the menu |
|
|
1426
|
+
| dataTest | string | `'dhis2-uicore-multiselect'` | | |
|
|
1427
|
+
| dense | boolean | | | |
|
|
1428
|
+
| disabled | boolean | | | |
|
|
1429
|
+
| empty | node | | | |
|
|
1430
|
+
| error | custom | | | |
|
|
1431
|
+
| filterPlaceholder | string | | | |
|
|
1432
|
+
| filterable | boolean | | | Adds a 'filter' field to the menu |
|
|
1433
|
+
| initialFocus | boolean | | | |
|
|
1434
|
+
| inputMaxHeight | string | | | |
|
|
1435
|
+
| loading | boolean | | | |
|
|
1436
|
+
| loadingText | string | | | |
|
|
1437
|
+
| maxHeight | string | | | |
|
|
1438
|
+
| noMatchText | custom | | | Required if `filterable` prop is `true` |
|
|
1439
|
+
| placeholder | string | | | |
|
|
1440
|
+
| prefix | string | | | |
|
|
1441
|
+
| selected | arrayOf(string) | `[]` | | |
|
|
1442
|
+
| tabIndex | string | | | |
|
|
1443
|
+
| valid | custom | | | |
|
|
1444
|
+
| warning | custom | | | |
|
|
1445
|
+
| onBlur | function | | | |
|
|
1446
|
+
| onChange | function | | | |
|
|
1447
|
+
| onFocus | function | | | |
|
|
1448
|
+
|
|
1449
|
+
### MultiSelectField
|
|
1450
|
+
|
|
1451
|
+
#### Usage
|
|
1452
|
+
|
|
1453
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1454
|
+
|
|
1455
|
+
```js
|
|
1456
|
+
import { MultiSelectField } from '@dhis2/ui'
|
|
1457
|
+
```
|
|
1458
|
+
|
|
1459
|
+
#### Props
|
|
1460
|
+
|
|
1461
|
+
| Name | Type | Default | Required | Description |
|
|
1462
|
+
| ----------------- | ----------------- | ---------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------- |
|
|
1463
|
+
| children | node | | | Should be `MultiSelectOption` components |
|
|
1464
|
+
| className | string | | | |
|
|
1465
|
+
| clearText | string │ function | `() => i18n.t('Clear')` | | Label for the button that clears selections |
|
|
1466
|
+
| clearable | boolean | | | Adds a button to the MultiSelect that clears selections when pressed |
|
|
1467
|
+
| dataTest | string | `'dhis2-uiwidgets-multiselectfield'` | | |
|
|
1468
|
+
| dense | boolean | | | Makes the MultiSelect smaller |
|
|
1469
|
+
| disabled | boolean | | | Disables the MultiSelect |
|
|
1470
|
+
| empty | node │ function | `() => i18n.t('No data found')` | | Text to display when there are no options |
|
|
1471
|
+
| error | custom | | | Adds 'error' appearance for validation feedback. Mutually exclusive with 'valid' and 'warning' props |
|
|
1472
|
+
| filterPlaceholder | node │ function | `() => i18n.t('Type to filter options')` | | Placeholder text to show in the filter field when it is empty |
|
|
1473
|
+
| filterable | boolean | | | Adds a field to filter options |
|
|
1474
|
+
| helpText | string | | | Useful guiding text to display below the MultiSelect |
|
|
1475
|
+
| initialFocus | boolean | | | Grabs initial focus on the page |
|
|
1476
|
+
| inputMaxHeight | string | | | Constrains the height of the input |
|
|
1477
|
+
| inputWidth | string | | | Sets the width of the input. Can be any valid CSS measurement |
|
|
1478
|
+
| label | string | | | Text for the label above the MultiSelect |
|
|
1479
|
+
| loading | boolean | | | Applies a loading appearance to the dropdown options |
|
|
1480
|
+
| loadingText | string │ function | `() => i18n.t('Loading options')` | | Text to display when `loading` is true |
|
|
1481
|
+
| maxHeight | string | | | Constrains height of the MultiSelect |
|
|
1482
|
+
| noMatchText | string │ function | `() => i18n.t('No options found')` | | Text to display when there are no filter results |
|
|
1483
|
+
| placeholder | string | | | Placeholder text when the MultiSelect is empty |
|
|
1484
|
+
| prefix | string | | | Leading text to prefix selections |
|
|
1485
|
+
| required | boolean | | | Indicates that a selection is required |
|
|
1486
|
+
| selected | arrayOf(string) | `[]` | | Selected items in the MultiSelect (each string should refer to the item's `value` attribute) |
|
|
1487
|
+
| tabIndex | string | | | |
|
|
1488
|
+
| valid | custom | | | Adds 'valid' appearance for validation feedback. Mutually exclusive with 'error' and 'warning' props |
|
|
1489
|
+
| validationText | string | | | Text to provide form validation feedback. Receives styles according to validation status |
|
|
1490
|
+
| warning | custom | | | Adds 'warning' appearance for validation feedback. Mutually exclusive with 'valid' and 'error' props |
|
|
1491
|
+
| onBlur | function | | | Called with signature `({ selected: [String] }, event)` |
|
|
1492
|
+
| onChange | function | | | Called with signature `({ selected: [String] }, event)` |
|
|
1493
|
+
| onFocus | function | | | Called with signature `({ selected: [String] }, event)` |
|
|
1494
|
+
|
|
1495
|
+
### MultiSelectOption
|
|
1496
|
+
|
|
1497
|
+
#### Usage
|
|
1498
|
+
|
|
1499
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1500
|
+
|
|
1501
|
+
```js
|
|
1502
|
+
import { MultiSelectOption } from '@dhis2/ui'
|
|
1503
|
+
```
|
|
1504
|
+
|
|
1505
|
+
#### Props
|
|
1506
|
+
|
|
1507
|
+
| Name | Type | Default | Required | Description |
|
|
1508
|
+
| --------- | -------- | ---------------------------------- | -------- | ----------- |
|
|
1509
|
+
| label | string | | \* | |
|
|
1510
|
+
| value | string | | \* | |
|
|
1511
|
+
| active | boolean | | | |
|
|
1512
|
+
| className | string | | | |
|
|
1513
|
+
| dataTest | string | `'dhis2-uicore-multiselectoption'` | | |
|
|
1514
|
+
| disabled | boolean | | | |
|
|
1515
|
+
| onClick | function | | | |
|
|
1516
|
+
|
|
1517
|
+
### Input
|
|
1518
|
+
|
|
1519
|
+
#### Usage
|
|
1520
|
+
|
|
1521
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1522
|
+
|
|
1523
|
+
```js
|
|
1524
|
+
import { Input } from '@dhis2/ui'
|
|
1525
|
+
```
|
|
1526
|
+
|
|
1527
|
+
#### Props
|
|
1528
|
+
|
|
1529
|
+
| Name | Type | Default | Required | Description |
|
|
1530
|
+
| -------------- | -------- | --------- | -------- | ----------- |
|
|
1531
|
+
| dataTest | string | | \* | |
|
|
1532
|
+
| className | string | | | |
|
|
1533
|
+
| clearText | custom | | | |
|
|
1534
|
+
| clearable | boolean | | | |
|
|
1535
|
+
| disabled | boolean | | | |
|
|
1536
|
+
| inputMaxHeight | string | `'100px'` | | |
|
|
1537
|
+
| options | node | | | |
|
|
1538
|
+
| placeholder | string | | | |
|
|
1539
|
+
| prefix | string | | | |
|
|
1540
|
+
| selected | string | | | |
|
|
1541
|
+
| onChange | function | | | |
|
|
1542
|
+
|
|
1543
|
+
### Menu
|
|
1544
|
+
|
|
1545
|
+
#### Usage
|
|
1546
|
+
|
|
1547
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1548
|
+
|
|
1549
|
+
```js
|
|
1550
|
+
import { Menu } from '@dhis2/ui'
|
|
1551
|
+
```
|
|
1552
|
+
|
|
1553
|
+
#### Props
|
|
1554
|
+
|
|
1555
|
+
| Name | Type | Default | Required | Description |
|
|
1556
|
+
| ---------------- | -------- | ------- | -------- | ----------- |
|
|
1557
|
+
| dataTest | string | | \* | |
|
|
1558
|
+
| empty | node | `''` | | |
|
|
1559
|
+
| handleClose | function | | | |
|
|
1560
|
+
| handleFocusInput | function | | | |
|
|
1561
|
+
| options | node | | | |
|
|
1562
|
+
| selected | string | | | |
|
|
1563
|
+
| onChange | function | | | |
|
|
1564
|
+
|
|
1565
|
+
### SingleSelect
|
|
1566
|
+
|
|
1567
|
+
#### Usage
|
|
1568
|
+
|
|
1569
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1570
|
+
|
|
1571
|
+
```js
|
|
1572
|
+
import { SingleSelect } from '@dhis2/ui'
|
|
1573
|
+
```
|
|
1574
|
+
|
|
1575
|
+
#### Props
|
|
1576
|
+
|
|
1577
|
+
| Name | Type | Default | Required | Description |
|
|
1578
|
+
| ----------------- | -------- | ----------------------------- | -------- | ------------------------------------------------------------------------------------------------------- |
|
|
1579
|
+
| children | node | | | |
|
|
1580
|
+
| className | string | | | |
|
|
1581
|
+
| clearText | custom | | | Text on button that clears selection. Required if `clearable` prop is true |
|
|
1582
|
+
| clearable | boolean | | | Adds a button to clear selection |
|
|
1583
|
+
| dataTest | string | `'dhis2-uicore-singleselect'` | | |
|
|
1584
|
+
| dense | boolean | | | |
|
|
1585
|
+
| disabled | boolean | | | |
|
|
1586
|
+
| empty | node | | | Text or component to display when there are no options |
|
|
1587
|
+
| error | custom | | | Applies 'error' appearance for validation feedback. Mutually exclusive with `warning` and `valid` props |
|
|
1588
|
+
| filterPlaceholder | string | | | |
|
|
1589
|
+
| filterable | boolean | | | Adds a filter field to add text to filter options |
|
|
1590
|
+
| initialFocus | boolean | | | |
|
|
1591
|
+
| inputMaxHeight | string | | | |
|
|
1592
|
+
| loading | boolean | | | |
|
|
1593
|
+
| loadingText | string | | | |
|
|
1594
|
+
| maxHeight | string | | | |
|
|
1595
|
+
| noMatchText | custom | | | Text to show when filter returns no results. Required if `filterable` prop is true |
|
|
1596
|
+
| placeholder | string | | | |
|
|
1597
|
+
| prefix | string | | | |
|
|
1598
|
+
| selected | string | `''` | | |
|
|
1599
|
+
| tabIndex | string | | | |
|
|
1600
|
+
| valid | custom | | | Applies 'valid' appearance for validation feedback. Mutually exclusive with `warning` and `error` props |
|
|
1601
|
+
| warning | custom | | | Applies 'warning' appearance for validation feedback. Mutually exclusive with `valid` and `error` props |
|
|
1602
|
+
| onBlur | function | | | |
|
|
1603
|
+
| onChange | function | | | |
|
|
1604
|
+
| onFocus | function | | | |
|
|
1605
|
+
|
|
1606
|
+
### SingleSelectField
|
|
1607
|
+
|
|
1608
|
+
#### Usage
|
|
1609
|
+
|
|
1610
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1611
|
+
|
|
1612
|
+
```js
|
|
1613
|
+
import { SingleSelectField } from '@dhis2/ui'
|
|
1614
|
+
```
|
|
1615
|
+
|
|
1616
|
+
#### Props
|
|
1617
|
+
|
|
1618
|
+
| Name | Type | Default | Required | Description |
|
|
1619
|
+
| ----------------- | ----------------- | ---------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------- |
|
|
1620
|
+
| children | node | | | Should be `SingleSelectOption` components |
|
|
1621
|
+
| className | string | | | |
|
|
1622
|
+
| clearText | string │ function | `() => i18n.t('Clear')` | | Label for the button that clears selections |
|
|
1623
|
+
| clearable | boolean | | | Adds a button to the SingleSelect that clears selections when pressed |
|
|
1624
|
+
| dataTest | string | `'dhis2-uiwidgets-singleselectfield'` | | |
|
|
1625
|
+
| dense | boolean | | | Makes the SingleSelect smaller |
|
|
1626
|
+
| disabled | boolean | | | Disables the SingleSelect |
|
|
1627
|
+
| empty | node │ function | `() => i18n.t('No data found')` | | Text to display when there are no options |
|
|
1628
|
+
| error | custom | | | Adds 'error' appearance for validation feedback. Mutually exclusive with 'valid' and 'warning' props |
|
|
1629
|
+
| filterPlaceholder | node │ function | `() => i18n.t('Type to filter options')` | | Placeholder text to show in the filter field when it is empty |
|
|
1630
|
+
| filterable | boolean | | | Adds a field to filter options |
|
|
1631
|
+
| helpText | string | | | Useful guiding text to display below the SingleSelect |
|
|
1632
|
+
| initialFocus | boolean | | | Grabs initial focus on the page |
|
|
1633
|
+
| inputMaxHeight | string | | | Constrains the height of the input |
|
|
1634
|
+
| inputWidth | string | | | Sets the width of the input. Can be any valid CSS measurement |
|
|
1635
|
+
| label | string | | | Text for the label above the SingleSelect |
|
|
1636
|
+
| loading | boolean | | | Applies a loading appearance to the dropdown options |
|
|
1637
|
+
| loadingText | string │ function | `() => i18n.t('Loading options')` | | Text to display when `loading` is true |
|
|
1638
|
+
| maxHeight | string | | | Constrains height of the SingleSelect |
|
|
1639
|
+
| noMatchText | string │ function | `() => i18n.t('No options found')` | | Text to display when there are no filter results |
|
|
1640
|
+
| placeholder | string | | | Placeholder text when the SingleSelect is empty |
|
|
1641
|
+
| prefix | string | | | Leading text to prefix selections |
|
|
1642
|
+
| required | boolean | | | Indicates that a selection is required |
|
|
1643
|
+
| selected | string | `''` | | Selected item in the SingleSelect (the string should refer to the item's `value` attribute) |
|
|
1644
|
+
| tabIndex | string | | | |
|
|
1645
|
+
| valid | custom | | | Adds 'valid' appearance for validation feedback. Mutually exclusive with 'error' and 'warning' props |
|
|
1646
|
+
| validationText | string | | | Text to provide form validation feedback. Receives styles according to validation status |
|
|
1647
|
+
| warning | custom | | | Adds 'warning' appearance for validation feedback. Mutually exclusive with 'valid' and 'error' props |
|
|
1648
|
+
| onBlur | function | | | Called with signature `({ selected: string }, event)` |
|
|
1649
|
+
| onChange | function | | | Called with signature `({ selected: string }, event)` |
|
|
1650
|
+
| onFocus | function | | | Called with signature `({ selected: string }, event)` |
|
|
1651
|
+
|
|
1652
|
+
### SingleSelectOption
|
|
1653
|
+
|
|
1654
|
+
#### Usage
|
|
1655
|
+
|
|
1656
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1657
|
+
|
|
1658
|
+
```js
|
|
1659
|
+
import { SingleSelectOption } from '@dhis2/ui'
|
|
1660
|
+
```
|
|
1661
|
+
|
|
1662
|
+
#### Props
|
|
1663
|
+
|
|
1664
|
+
| Name | Type | Default | Required | Description |
|
|
1665
|
+
| --------- | -------- | ----------------------------------- | -------- | ----------- |
|
|
1666
|
+
| label | string | | \* | |
|
|
1667
|
+
| value | string | | \* | |
|
|
1668
|
+
| active | boolean | | | |
|
|
1669
|
+
| className | string | | | |
|
|
1670
|
+
| dataTest | string | `'dhis2-uicore-singleselectoption'` | | |
|
|
1671
|
+
| disabled | boolean | | | |
|
|
1672
|
+
| onClick | function | | | |
|
|
1673
|
+
|
|
1674
|
+
### SelectorBar
|
|
1675
|
+
|
|
1676
|
+
#### Usage
|
|
1677
|
+
|
|
1678
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1679
|
+
|
|
1680
|
+
```js
|
|
1681
|
+
import { SelectorBar } from '@dhis2/ui'
|
|
1682
|
+
```
|
|
1683
|
+
|
|
1684
|
+
#### Props
|
|
1685
|
+
|
|
1686
|
+
| Name | Type | Default | Required | Description |
|
|
1687
|
+
| ---------------------- | -------- | ------------------------ | -------- | ----------- |
|
|
1688
|
+
| children | any | | \* | |
|
|
1689
|
+
| additionalContent | any | | | |
|
|
1690
|
+
| className | string | | | |
|
|
1691
|
+
| dataTest | string | `'dhis2-ui-selectorbar'` | | |
|
|
1692
|
+
| disableClearSelections | boolean | | | |
|
|
1693
|
+
| onClearSelectionClick | function | | | |
|
|
1694
|
+
|
|
1695
|
+
### SelectorBarItem
|
|
1696
|
+
|
|
1697
|
+
#### Usage
|
|
1698
|
+
|
|
1699
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1700
|
+
|
|
1701
|
+
```js
|
|
1702
|
+
import { SelectorBarItem } from '@dhis2/ui'
|
|
1703
|
+
```
|
|
1704
|
+
|
|
1705
|
+
#### Props
|
|
1706
|
+
|
|
1707
|
+
| Name | Type | Default | Required | Description |
|
|
1708
|
+
| -------------- | -------- | ---------------------------- | -------- | ----------- |
|
|
1709
|
+
| children | any | | \* | |
|
|
1710
|
+
| label | string | | \* | |
|
|
1711
|
+
| noValueMessage | string | | \* | |
|
|
1712
|
+
| open | boolean | | \* | |
|
|
1713
|
+
| setOpen | function | | \* | |
|
|
1714
|
+
| className | string | | | |
|
|
1715
|
+
| dataTest | string | `'dhis2-ui-selectorbaritem'` | | |
|
|
1716
|
+
| disabled | boolean | | | |
|
|
1717
|
+
| value | string | | | |
|
|
1718
|
+
|
|
1719
|
+
### SharingDialog
|
|
1720
|
+
|
|
1721
|
+
#### Usage
|
|
1722
|
+
|
|
1723
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1724
|
+
|
|
1725
|
+
```js
|
|
1726
|
+
import { SharingDialog } from '@dhis2/ui'
|
|
1727
|
+
```
|
|
1728
|
+
|
|
1729
|
+
#### Props
|
|
1730
|
+
|
|
1731
|
+
| Name | Type | Default | Required | Description |
|
|
1732
|
+
| ---- | -------- | ------- | -------- | ----------------------------- |
|
|
1733
|
+
| id | string | | \* | The id of the object to share |
|
|
1734
|
+
| type | import { |
|
|
1735
|
+
|
|
1736
|
+
ACCESS_NONE,
|
|
1737
|
+
ACCESS_VIEW_ONLY,
|
|
1738
|
+
ACCESS_VIEW_AND_EDIT,
|
|
1739
|
+
VISUALIZATION,
|
|
1740
|
+
DASHBOARD,
|
|
1741
|
+
EVENT_VISUALIZATION,
|
|
1742
|
+
INTERPRETATION,
|
|
1743
|
+
|
|
1744
|
+
} from './constants.js' │ import {
|
|
1745
|
+
ACCESS_NONE,
|
|
1746
|
+
ACCESS_VIEW_ONLY,
|
|
1747
|
+
ACCESS_VIEW_AND_EDIT,
|
|
1748
|
+
VISUALIZATION,
|
|
1749
|
+
DASHBOARD,
|
|
1750
|
+
EVENT_VISUALIZATION,
|
|
1751
|
+
INTERPRETATION,
|
|
1752
|
+
} from './constants.js' │ import {
|
|
1753
|
+
ACCESS_NONE,
|
|
1754
|
+
ACCESS_VIEW_ONLY,
|
|
1755
|
+
ACCESS_VIEW_AND_EDIT,
|
|
1756
|
+
VISUALIZATION,
|
|
1757
|
+
DASHBOARD,
|
|
1758
|
+
EVENT_VISUALIZATION,
|
|
1759
|
+
INTERPRETATION,
|
|
1760
|
+
} from './constants.js' │ import {
|
|
1761
|
+
ACCESS_NONE,
|
|
1762
|
+
ACCESS_VIEW_ONLY,
|
|
1763
|
+
ACCESS_VIEW_AND_EDIT,
|
|
1764
|
+
VISUALIZATION,
|
|
1765
|
+
DASHBOARD,
|
|
1766
|
+
EVENT_VISUALIZATION,
|
|
1767
|
+
INTERPRETATION,
|
|
1768
|
+
} from './constants.js'||\*|The type of object to share|
|
|
1769
|
+
|initialSharingSettings|{<br/> "allowPublic": "boolean",<br/> "groups": "objectOf",<br/> "name": "string",<br/> "public": "import {\n ACCESS_NONE,\n ACCESS_VIEW_ONLY,\n ACCESS_VIEW_AND_EDIT,\n VISUALIZATION,\n DASHBOARD,\n EVENT_VISUALIZATION,\n INTERPRETATION,\n} from './constants.js' │ import {\n ACCESS_NONE,\n ACCESS_VIEW_ONLY,\n ACCESS_VIEW_AND_EDIT,\n VISUALIZATION,\n DASHBOARD,\n EVENT_VISUALIZATION,\n INTERPRETATION,\n} from './constants.js' │ import {\n ACCESS_NONE,\n ACCESS_VIEW_ONLY,\n ACCESS_VIEW_AND_EDIT,\n VISUALIZATION,\n DASHBOARD,\n EVENT_VISUALIZATION,\n INTERPRETATION,\n} from './constants.js'",<br/> "users": "objectOf"<br/>}|`{ name: '', allowPublic: true, public: ACCESS_NONE, groups: {}, users: {}, }`||Used to seed the component with data to show whilst loading|
|
|
1770
|
+
|onClose|function|`() => {}`|||
|
|
1771
|
+
|onError|function|`() => {}`|||
|
|
1772
|
+
|onSave|function|`() => {}`|||
|
|
1773
|
+
|
|
1774
|
+
### Modal
|
|
1775
|
+
|
|
1776
|
+
#### Usage
|
|
1777
|
+
|
|
1778
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1779
|
+
|
|
1780
|
+
```js
|
|
1781
|
+
import { Modal } from '@dhis2/ui'
|
|
1782
|
+
```
|
|
1783
|
+
|
|
1784
|
+
#### Props
|
|
1785
|
+
|
|
1786
|
+
| Name | Type | Default | Required | Description |
|
|
1787
|
+
| -------- | -------- | ------- | -------- | ----------- |
|
|
1788
|
+
| children | node | | \* | |
|
|
1789
|
+
| name | string | | | |
|
|
1790
|
+
| onClose | function | | | |
|
|
1791
|
+
|
|
1792
|
+
### Switch
|
|
1793
|
+
|
|
1794
|
+
#### Usage
|
|
1795
|
+
|
|
1796
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1797
|
+
|
|
1798
|
+
```js
|
|
1799
|
+
import { Switch } from '@dhis2/ui'
|
|
1800
|
+
```
|
|
1801
|
+
|
|
1802
|
+
#### Props
|
|
1803
|
+
|
|
1804
|
+
| Name | Type | Default | Required | Description |
|
|
1805
|
+
| ------------ | -------- | ----------------------- | -------- | -------------------------------------------------------------------------------------------------------- |
|
|
1806
|
+
| ariaLabel | string | | | Sets an aria-label attribute on the input |
|
|
1807
|
+
| checked | boolean | `false` | | |
|
|
1808
|
+
| className | string | | | |
|
|
1809
|
+
| dataTest | string | `'dhis2-uicore-switch'` | | |
|
|
1810
|
+
| dense | boolean | | | Makes the switch smaller for information-dense layouts |
|
|
1811
|
+
| disabled | boolean | | | Disables the switch |
|
|
1812
|
+
| error | custom | | | Applies 'error' styles for validation feedback. Mutually exclusive with `valid` and `warning` prop types |
|
|
1813
|
+
| initialFocus | boolean | | | Grab initial focus on the page |
|
|
1814
|
+
| label | node | | | Label for the switch. Can be a string or an element, for example an image |
|
|
1815
|
+
| name | string | | | Name associated with the switch. Passed to event handlers in object |
|
|
1816
|
+
| role | string | `'switch'` | | Sets a role attribute on the input |
|
|
1817
|
+
| tabIndex | string | | | |
|
|
1818
|
+
| valid | custom | | | Applies 'valid' styles for validation feedback. Mutually exclusive with `error` and `warning` prop types |
|
|
1819
|
+
| value | string | | | Value associated with the switch. Passed to event handlers in object |
|
|
1820
|
+
| warning | custom | | | Applies 'warning' styles for validation feedback. Mutually exclusive with `valid` and `error` prop types |
|
|
1821
|
+
| onBlur | function | | | Called with signature `({ name: string, value: string, checked: bool }, event)` |
|
|
1822
|
+
| onChange | function | | | Called with signature `({ name: string, value: string, checked: bool }, event)` |
|
|
1823
|
+
| onFocus | function | | | Called with signature `({ name: string, value: string, checked: bool }, event)` |
|
|
1824
|
+
|
|
1825
|
+
### SwitchField
|
|
1826
|
+
|
|
1827
|
+
#### Usage
|
|
1828
|
+
|
|
1829
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1830
|
+
|
|
1831
|
+
```js
|
|
1832
|
+
import { SwitchField } from '@dhis2/ui'
|
|
1833
|
+
```
|
|
1834
|
+
|
|
1835
|
+
#### Props
|
|
1836
|
+
|
|
1837
|
+
| Name | Type | Default | Required | Description |
|
|
1838
|
+
| -------------- | -------- | ------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
1839
|
+
| checked | boolean | | | |
|
|
1840
|
+
| className | string | | | |
|
|
1841
|
+
| dataTest | string | `'dhis2-uiwidgets-switchfield'` | | |
|
|
1842
|
+
| dense | boolean | | | Smaller dimensions for information-dense layouts |
|
|
1843
|
+
| disabled | boolean | | | Disables the switch |
|
|
1844
|
+
| error | custom | | | Applies 'error' styling to switch and validation text for feedback. Mutually exclusive with `warning` and `valid` props |
|
|
1845
|
+
| helpText | string | | | Useful instructions for the user |
|
|
1846
|
+
| initialFocus | boolean | | | |
|
|
1847
|
+
| label | node | | | Labels the switch |
|
|
1848
|
+
| name | string | | | Name associate with the switch. Passed in object as argument to event handlers |
|
|
1849
|
+
| required | boolean | | | Adds an asterisk to indicate this field is required |
|
|
1850
|
+
| tabIndex | string | | | |
|
|
1851
|
+
| valid | custom | | | Applies 'valid' styling to switch and validation text for feedback. Mutually exclusive with `warning` and `error` props |
|
|
1852
|
+
| validationText | string | | | Adds text below the switch to provide validation feedback. Acquires styles from `valid`, `warning` and `error` statuses |
|
|
1853
|
+
| value | string | | | Value associated with the switch. Passed in object as argument to event handlers |
|
|
1854
|
+
| warning | custom | | | Applies 'warning' styling to switch and validation text for feedback. Mutually exclusive with `valid` and `error` props |
|
|
1855
|
+
| onBlur | function | | | Called with signature ({ name: string, value: string, checked: bool }, event) |
|
|
1856
|
+
| onChange | function | | | Called with signature ({ name: string, value: string, checked: bool }, event) |
|
|
1857
|
+
| onFocus | function | | | Called with signature ({ name: string, value: string, checked: bool }, event) |
|
|
1858
|
+
|
|
1859
|
+
### Tab
|
|
1860
|
+
|
|
1861
|
+
#### Usage
|
|
1862
|
+
|
|
1863
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1864
|
+
|
|
1865
|
+
```js
|
|
1866
|
+
import { Tab } from '@dhis2/ui'
|
|
1867
|
+
```
|
|
1868
|
+
|
|
1869
|
+
#### Props
|
|
1870
|
+
|
|
1871
|
+
| Name | Type | Default | Required | Description |
|
|
1872
|
+
| --------- | -------- | -------------------- | -------- | --------------------------------------- |
|
|
1873
|
+
| children | node | | | |
|
|
1874
|
+
| className | string | | | |
|
|
1875
|
+
| dataTest | string | `'dhis2-uicore-tab'` | | |
|
|
1876
|
+
| disabled | boolean | | | |
|
|
1877
|
+
| icon | element | | | |
|
|
1878
|
+
| selected | boolean | | | Indicates this tab is selected |
|
|
1879
|
+
| onClick | function | | | Called with the signature `({}, event)` |
|
|
1880
|
+
|
|
1881
|
+
### TabBar
|
|
1882
|
+
|
|
1883
|
+
#### Usage
|
|
1884
|
+
|
|
1885
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1886
|
+
|
|
1887
|
+
```js
|
|
1888
|
+
import { TabBar } from '@dhis2/ui'
|
|
1889
|
+
```
|
|
1890
|
+
|
|
1891
|
+
#### Props
|
|
1892
|
+
|
|
1893
|
+
| Name | Type | Default | Required | Description |
|
|
1894
|
+
| ---------- | ------- | ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1895
|
+
| children | node | | | |
|
|
1896
|
+
| className | string | | | |
|
|
1897
|
+
| dataTest | string | `'dhis2-uicore-tabbar'` | | |
|
|
1898
|
+
| fixed | boolean | | | Fixed tabs fill the width of their container. If false (i.e. fluid), tabs take up an amount of space defined by the tab name. Fluid tabs should be used most of the time. |
|
|
1899
|
+
| scrollable | boolean | | | Enables horizontal scrolling for many tabs that don't fit the width of the container |
|
|
1900
|
+
|
|
1901
|
+
### DataTableCell
|
|
1902
|
+
|
|
1903
|
+
#### Usage
|
|
1904
|
+
|
|
1905
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1906
|
+
|
|
1907
|
+
```js
|
|
1908
|
+
import { DataTableCell } from '@dhis2/ui'
|
|
1909
|
+
```
|
|
1910
|
+
|
|
1911
|
+
#### Props
|
|
1912
|
+
|
|
1913
|
+
| Name | Type | Default | Required | Description |
|
|
1914
|
+
| ----------- | --------------------------- | ------------------------------ | -------- | -------------------------------------------------------------------- |
|
|
1915
|
+
| active | boolean | | | To toggle background color, for example for editing |
|
|
1916
|
+
| align | 'left' │ 'center' │ 'right' | `'left'` | | |
|
|
1917
|
+
| bordered | boolean | | | |
|
|
1918
|
+
| children | node | | | |
|
|
1919
|
+
| className | string | | | |
|
|
1920
|
+
| colSpan | string | | | |
|
|
1921
|
+
| dataTest | string | `'dhis2-uicore-datatablecell'` | | |
|
|
1922
|
+
| error | custom | | | Mutually exclusive with muted and valid |
|
|
1923
|
+
| fixed | boolean | | | When true a TableHeaderCell with sticky positioning will be rendered |
|
|
1924
|
+
| large | boolean | | | |
|
|
1925
|
+
| left | custom | `'auto'` | | Required when fixed |
|
|
1926
|
+
| muted | custom | | | Mutually exclusive with error and valid |
|
|
1927
|
+
| role | string | | | |
|
|
1928
|
+
| rowSpan | string | | | |
|
|
1929
|
+
| scope | string | | | |
|
|
1930
|
+
| staticStyle | boolean | | | Surpress hover and active event styles |
|
|
1931
|
+
| tag | 'td' │ 'th' | | | Render a TableDataCell or TableHeaderCell respectively |
|
|
1932
|
+
| valid | custom | | | Mutually exclusive with error and muted |
|
|
1933
|
+
| width | custom | `'auto'` | | Required when fixed |
|
|
1934
|
+
| onClick | function | | | |
|
|
1935
|
+
|
|
1936
|
+
### DataTable
|
|
1937
|
+
|
|
1938
|
+
#### Usage
|
|
1939
|
+
|
|
1940
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1941
|
+
|
|
1942
|
+
```js
|
|
1943
|
+
import { DataTable } from '@dhis2/ui'
|
|
1944
|
+
```
|
|
1945
|
+
|
|
1946
|
+
#### Props
|
|
1947
|
+
|
|
1948
|
+
| Name | Type | Default | Required | Description |
|
|
1949
|
+
| ------------ | ---------------------------------------- | -------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1950
|
+
| children | node | | | Should be `<DataTableHead>`, `<DataTableBody>`, and `<DataTableFoot>` components |
|
|
1951
|
+
| className | string | | | |
|
|
1952
|
+
| dataTest | string | `'dhis2-uicore-datatable'` | | |
|
|
1953
|
+
| layout | 'auto' │ 'fixed' │ 'initial' │ 'inherit' | `'auto'` | | Sets the `datatable-layout` property. Switching to `fixed` can prevent style<br/>issues when dealing with a datatable with multiple frozen columns or when dealing<br/>with filter elements in the datatable headers. |
|
|
1954
|
+
| role | string | | | |
|
|
1955
|
+
| scrollHeight | string | | | Sets max-height of scrollbox |
|
|
1956
|
+
| scrollWidth | string | | | Sets max-width of scrollbox |
|
|
1957
|
+
| width | string | `'100%'` | | Sets the `width` property. Providing an explicit width can prevent style<br/>issues when dealing with horizontally scrolling datatables with a fixed layout. |
|
|
1958
|
+
|
|
1959
|
+
### StackedTableBody
|
|
1960
|
+
|
|
1961
|
+
#### Usage
|
|
1962
|
+
|
|
1963
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1964
|
+
|
|
1965
|
+
```js
|
|
1966
|
+
import { StackedTableBody } from '@dhis2/ui'
|
|
1967
|
+
```
|
|
1968
|
+
|
|
1969
|
+
#### Props
|
|
1970
|
+
|
|
1971
|
+
| Name | Type | Default | Required | Description |
|
|
1972
|
+
| --------- | ------ | --------------------------------- | -------- | ----------- |
|
|
1973
|
+
| children | node | | | |
|
|
1974
|
+
| className | string | | | |
|
|
1975
|
+
| dataTest | string | `'dhis2-uicore-stackedtablebody'` | | |
|
|
1976
|
+
|
|
1977
|
+
### StackedTableCellHead
|
|
1978
|
+
|
|
1979
|
+
#### Usage
|
|
1980
|
+
|
|
1981
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
1982
|
+
|
|
1983
|
+
```js
|
|
1984
|
+
import { StackedTableCellHead } from '@dhis2/ui'
|
|
1985
|
+
```
|
|
1986
|
+
|
|
1987
|
+
#### Props
|
|
1988
|
+
|
|
1989
|
+
| Name | Type | Default | Required | Description |
|
|
1990
|
+
| --------- | ------ | ------------------------------------- | -------- | ----------- |
|
|
1991
|
+
| children | string | `''` | | |
|
|
1992
|
+
| className | string | | | |
|
|
1993
|
+
| colSpan | string | | | |
|
|
1994
|
+
| dataTest | string | `'dhis2-uicore-stackedtablecellhead'` | | |
|
|
1995
|
+
| rowSpan | string | | | |
|
|
1996
|
+
|
|
1997
|
+
### StackedTableCell
|
|
1998
|
+
|
|
1999
|
+
#### Usage
|
|
2000
|
+
|
|
2001
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2002
|
+
|
|
2003
|
+
```js
|
|
2004
|
+
import { StackedTableCell } from '@dhis2/ui'
|
|
2005
|
+
```
|
|
2006
|
+
|
|
2007
|
+
#### Props
|
|
2008
|
+
|
|
2009
|
+
| Name | Type | Default | Required | Description |
|
|
2010
|
+
| ------------ | --------------- | --------------------------------- | -------- | ----------- |
|
|
2011
|
+
| children | node | | | |
|
|
2012
|
+
| className | string | | | |
|
|
2013
|
+
| colSpan | string | | | |
|
|
2014
|
+
| column | number | | | |
|
|
2015
|
+
| dataTest | string | `'dhis2-uicore-stackedtablecell'` | | |
|
|
2016
|
+
| headerLabels | arrayOf(string) | `[]` | | |
|
|
2017
|
+
| hideTitle | boolean | | | |
|
|
2018
|
+
| rowSpan | string | | | |
|
|
2019
|
+
| title | string | | | |
|
|
2020
|
+
|
|
2021
|
+
### StackedTableFoot
|
|
2022
|
+
|
|
2023
|
+
#### Usage
|
|
2024
|
+
|
|
2025
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2026
|
+
|
|
2027
|
+
```js
|
|
2028
|
+
import { StackedTableFoot } from '@dhis2/ui'
|
|
2029
|
+
```
|
|
2030
|
+
|
|
2031
|
+
#### Props
|
|
2032
|
+
|
|
2033
|
+
| Name | Type | Default | Required | Description |
|
|
2034
|
+
| --------- | ------ | --------------------------------- | -------- | ----------- |
|
|
2035
|
+
| children | node | | | |
|
|
2036
|
+
| className | string | | | |
|
|
2037
|
+
| dataTest | string | `'dhis2-uicore-stackedtablefoot'` | | |
|
|
2038
|
+
|
|
2039
|
+
### StackedTableHead
|
|
2040
|
+
|
|
2041
|
+
#### Usage
|
|
2042
|
+
|
|
2043
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2044
|
+
|
|
2045
|
+
```js
|
|
2046
|
+
import { StackedTableHead } from '@dhis2/ui'
|
|
2047
|
+
```
|
|
2048
|
+
|
|
2049
|
+
#### Props
|
|
2050
|
+
|
|
2051
|
+
| Name | Type | Default | Required | Description |
|
|
2052
|
+
| --------- | ------ | --------------------------------- | -------- | ----------- |
|
|
2053
|
+
| children | node | | | |
|
|
2054
|
+
| className | string | | | |
|
|
2055
|
+
| dataTest | string | `'dhis2-uicore-stackedtablehead'` | | |
|
|
2056
|
+
|
|
2057
|
+
### StackedTableRowHead
|
|
2058
|
+
|
|
2059
|
+
#### Usage
|
|
2060
|
+
|
|
2061
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2062
|
+
|
|
2063
|
+
```js
|
|
2064
|
+
import { StackedTableRowHead } from '@dhis2/ui'
|
|
2065
|
+
```
|
|
2066
|
+
|
|
2067
|
+
#### Props
|
|
2068
|
+
|
|
2069
|
+
| Name | Type | Default | Required | Description |
|
|
2070
|
+
| --------- | ------ | ------------------------------------ | -------- | ----------- |
|
|
2071
|
+
| children | node | | | |
|
|
2072
|
+
| className | string | | | |
|
|
2073
|
+
| dataTest | string | `'dhis2-uicore-stackedtablerowhead'` | | |
|
|
2074
|
+
|
|
2075
|
+
### StackedTableRow
|
|
2076
|
+
|
|
2077
|
+
#### Usage
|
|
2078
|
+
|
|
2079
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2080
|
+
|
|
2081
|
+
```js
|
|
2082
|
+
import { StackedTableRow } from '@dhis2/ui'
|
|
2083
|
+
```
|
|
2084
|
+
|
|
2085
|
+
#### Props
|
|
2086
|
+
|
|
2087
|
+
| Name | Type | Default | Required | Description |
|
|
2088
|
+
| --------- | ------ | -------------------------------- | -------- | ----------- |
|
|
2089
|
+
| children | node | | | |
|
|
2090
|
+
| className | string | | | |
|
|
2091
|
+
| dataTest | string | `'dhis2-uicore-stackedtablerow'` | | |
|
|
2092
|
+
|
|
2093
|
+
### StackedTable
|
|
2094
|
+
|
|
2095
|
+
#### Usage
|
|
2096
|
+
|
|
2097
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2098
|
+
|
|
2099
|
+
```js
|
|
2100
|
+
import { StackedTable } from '@dhis2/ui'
|
|
2101
|
+
```
|
|
2102
|
+
|
|
2103
|
+
#### Props
|
|
2104
|
+
|
|
2105
|
+
| Name | Type | Default | Required | Description |
|
|
2106
|
+
| ------------ | --------------- | ----------------------------- | -------- | ---------------------------------------------------------------------- |
|
|
2107
|
+
| children | node | | | |
|
|
2108
|
+
| className | string | | | |
|
|
2109
|
+
| dataTest | string | `'dhis2-uicore-stackedtable'` | | |
|
|
2110
|
+
| headerLabels | arrayOf(string) | | | Labels for columns. Use an empty string for a column without a header. |
|
|
2111
|
+
|
|
2112
|
+
### Table
|
|
2113
|
+
|
|
2114
|
+
#### Usage
|
|
2115
|
+
|
|
2116
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2117
|
+
|
|
2118
|
+
```js
|
|
2119
|
+
import { Table } from '@dhis2/ui'
|
|
2120
|
+
```
|
|
2121
|
+
|
|
2122
|
+
#### Props
|
|
2123
|
+
|
|
2124
|
+
| Name | Type | Default | Required | Description |
|
|
2125
|
+
| --------- | ------ | ------- | -------- | ----------- |
|
|
2126
|
+
| children | node | | \* | |
|
|
2127
|
+
| className | string | | | |
|
|
2128
|
+
| dataTest | string | | | |
|
|
2129
|
+
|
|
2130
|
+
### TableBody
|
|
2131
|
+
|
|
2132
|
+
#### Usage
|
|
2133
|
+
|
|
2134
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2135
|
+
|
|
2136
|
+
```js
|
|
2137
|
+
import { TableBody } from '@dhis2/ui'
|
|
2138
|
+
```
|
|
2139
|
+
|
|
2140
|
+
#### Props
|
|
2141
|
+
|
|
2142
|
+
| Name | Type | Default | Required | Description |
|
|
2143
|
+
| --------- | ------ | -------------------------- | -------- | --------------------------------- |
|
|
2144
|
+
| children | node | | | Should be `<TableRow>` components |
|
|
2145
|
+
| className | string | | | |
|
|
2146
|
+
| dataTest | string | `'dhis2-uicore-tablebody'` | | |
|
|
2147
|
+
| role | string | | | |
|
|
2148
|
+
|
|
2149
|
+
### TableCellHead
|
|
2150
|
+
|
|
2151
|
+
#### Usage
|
|
2152
|
+
|
|
2153
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2154
|
+
|
|
2155
|
+
```js
|
|
2156
|
+
import { TableCellHead } from '@dhis2/ui'
|
|
2157
|
+
```
|
|
2158
|
+
|
|
2159
|
+
#### Props
|
|
2160
|
+
|
|
2161
|
+
| Name | Type | Default | Required | Description |
|
|
2162
|
+
| --------- | ------- | ------------------------------ | -------- | ---------------------------------------------------------- |
|
|
2163
|
+
| children | node | | | |
|
|
2164
|
+
| className | string | | | |
|
|
2165
|
+
| colSpan | string | | | |
|
|
2166
|
+
| dataTest | string | `'dhis2-uicore-tablecellhead'` | | |
|
|
2167
|
+
| dense | boolean | | | Uses less padding and height for information-dense layouts |
|
|
2168
|
+
| role | string | | | |
|
|
2169
|
+
| rowSpan | string | | | |
|
|
2170
|
+
|
|
2171
|
+
### TableCell
|
|
2172
|
+
|
|
2173
|
+
#### Usage
|
|
2174
|
+
|
|
2175
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2176
|
+
|
|
2177
|
+
```js
|
|
2178
|
+
import { TableCell } from '@dhis2/ui'
|
|
2179
|
+
```
|
|
2180
|
+
|
|
2181
|
+
#### Props
|
|
2182
|
+
|
|
2183
|
+
| Name | Type | Default | Required | Description |
|
|
2184
|
+
| --------- | ------- | -------------------------- | -------- | ----------------------------------------------------------- |
|
|
2185
|
+
| children | node | | | |
|
|
2186
|
+
| className | string | | | |
|
|
2187
|
+
| colSpan | string | | | |
|
|
2188
|
+
| dataTest | string | `'dhis2-uicore-tablecell'` | | |
|
|
2189
|
+
| dense | boolean | | | Usees less padding and height for information-dense layouts |
|
|
2190
|
+
| role | string | | | |
|
|
2191
|
+
| rowSpan | string | | | |
|
|
2192
|
+
|
|
2193
|
+
### TableFoot
|
|
2194
|
+
|
|
2195
|
+
#### Usage
|
|
2196
|
+
|
|
2197
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2198
|
+
|
|
2199
|
+
```js
|
|
2200
|
+
import { TableFoot } from '@dhis2/ui'
|
|
2201
|
+
```
|
|
2202
|
+
|
|
2203
|
+
#### Props
|
|
2204
|
+
|
|
2205
|
+
| Name | Type | Default | Required | Description |
|
|
2206
|
+
| --------- | ------ | -------------------------- | -------- | --------------------------------- |
|
|
2207
|
+
| children | node | | | Should be `<TableRow>` components |
|
|
2208
|
+
| className | string | | | |
|
|
2209
|
+
| dataTest | string | `'dhis2-uicore-tablefoot'` | | |
|
|
2210
|
+
| role | string | | | |
|
|
2211
|
+
|
|
2212
|
+
### TableHead
|
|
2213
|
+
|
|
2214
|
+
#### Usage
|
|
2215
|
+
|
|
2216
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2217
|
+
|
|
2218
|
+
```js
|
|
2219
|
+
import { TableHead } from '@dhis2/ui'
|
|
2220
|
+
```
|
|
2221
|
+
|
|
2222
|
+
#### Props
|
|
2223
|
+
|
|
2224
|
+
| Name | Type | Default | Required | Description |
|
|
2225
|
+
| --------- | ------ | -------------------------- | -------- | ------------------------------------- |
|
|
2226
|
+
| children | node | | | Should be `<TableRowHead>` components |
|
|
2227
|
+
| className | string | | | |
|
|
2228
|
+
| dataTest | string | `'dhis2-uicore-tablehead'` | | |
|
|
2229
|
+
| role | string | | | |
|
|
2230
|
+
|
|
2231
|
+
### TableRowHead
|
|
2232
|
+
|
|
2233
|
+
#### Usage
|
|
2234
|
+
|
|
2235
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2236
|
+
|
|
2237
|
+
```js
|
|
2238
|
+
import { TableRowHead } from '@dhis2/ui'
|
|
2239
|
+
```
|
|
2240
|
+
|
|
2241
|
+
#### Props
|
|
2242
|
+
|
|
2243
|
+
| Name | Type | Default | Required | Description |
|
|
2244
|
+
| --------------------- | ------- | ----------------------------- | -------- | ---------------------------------------------- |
|
|
2245
|
+
| children | node | | | Should be `<TableCellHead>` components |
|
|
2246
|
+
| className | string | | | |
|
|
2247
|
+
| dataTest | string | `'dhis2-uicore-tablerowhead'` | | |
|
|
2248
|
+
| role | string | | | |
|
|
2249
|
+
| suppressZebraStriping | boolean | | | Disables the default row striping for this row |
|
|
2250
|
+
|
|
2251
|
+
### TableRow
|
|
2252
|
+
|
|
2253
|
+
#### Usage
|
|
2254
|
+
|
|
2255
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2256
|
+
|
|
2257
|
+
```js
|
|
2258
|
+
import { TableRow } from '@dhis2/ui'
|
|
2259
|
+
```
|
|
2260
|
+
|
|
2261
|
+
#### Props
|
|
2262
|
+
|
|
2263
|
+
| Name | Type | Default | Required | Description |
|
|
2264
|
+
| --------------------- | ------- | ------------------------- | -------- | ------------------------------------------------------- |
|
|
2265
|
+
| children | node | | | Should be `<TableCell>` or `<TableCellHead>` components |
|
|
2266
|
+
| className | string | | | |
|
|
2267
|
+
| dataTest | string | `'dhis2-uicore-tablerow'` | | |
|
|
2268
|
+
| role | string | | | |
|
|
2269
|
+
| suppressZebraStriping | boolean | | | Disables the default row striping for this row |
|
|
2270
|
+
|
|
2271
|
+
### Table
|
|
2272
|
+
|
|
2273
|
+
#### Usage
|
|
2274
|
+
|
|
2275
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2276
|
+
|
|
2277
|
+
```js
|
|
2278
|
+
import { Table } from '@dhis2/ui'
|
|
2279
|
+
```
|
|
2280
|
+
|
|
2281
|
+
#### Props
|
|
2282
|
+
|
|
2283
|
+
| Name | Type | Default | Required | Description |
|
|
2284
|
+
| --------------------- | ------- | ---------------------- | -------- | -------------------------------------------------------------------- |
|
|
2285
|
+
| children | node | | | Should be `<TableHead>`, `<TableBody>`, and `<TableFoot>` components |
|
|
2286
|
+
| className | string | | | |
|
|
2287
|
+
| dataTest | string | `'dhis2-uicore-table'` | | |
|
|
2288
|
+
| role | string | | | |
|
|
2289
|
+
| suppressZebraStriping | boolean | | | Remove the default striping on alternating rows |
|
|
2290
|
+
|
|
2291
|
+
### DataTableColumnHeader
|
|
2292
|
+
|
|
2293
|
+
#### Usage
|
|
2294
|
+
|
|
2295
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2296
|
+
|
|
2297
|
+
```js
|
|
2298
|
+
import { DataTableColumnHeader } from '@dhis2/ui'
|
|
2299
|
+
```
|
|
2300
|
+
|
|
2301
|
+
#### Props
|
|
2302
|
+
|
|
2303
|
+
| Name | Type | Default | Required | Description |
|
|
2304
|
+
| ----------------- | --------------------------- | ---------------------------------- | -------- | ----------------------------------------------------------------------------------- |
|
|
2305
|
+
| align | 'left' │ 'center' │ 'right' | | | |
|
|
2306
|
+
| children | node | | | |
|
|
2307
|
+
| className | string | | | |
|
|
2308
|
+
| colSpan | string | | | |
|
|
2309
|
+
| dataTest | string | `'dhis2-uicore-datatablecellhead'` | | |
|
|
2310
|
+
| filter | custom | | | The filter element (JSX), required when onFilterIconClick or showFilter are present |
|
|
2311
|
+
| fixed | boolean | | | |
|
|
2312
|
+
| large | boolean | | | |
|
|
2313
|
+
| left | custom | | | Left or top required when fixed |
|
|
2314
|
+
| name | string | | | Can be used to match a column with a property name |
|
|
2315
|
+
| role | string | | | |
|
|
2316
|
+
| rowSpan | string | | | |
|
|
2317
|
+
| scope | string | | | |
|
|
2318
|
+
| showFilter | custom | | | |
|
|
2319
|
+
| sortDirection | custom | | | |
|
|
2320
|
+
| sortIconTitle | string | | | |
|
|
2321
|
+
| top | custom | | | Left or top required when fixed |
|
|
2322
|
+
| width | string | | | |
|
|
2323
|
+
| onFilterIconClick | custom | | | |
|
|
2324
|
+
| onSortIconClick | custom | | | Sort icon click callback with `nextSortDirection` and `name` in payload |
|
|
2325
|
+
|
|
2326
|
+
### DataTableRow
|
|
2327
|
+
|
|
2328
|
+
#### Usage
|
|
2329
|
+
|
|
2330
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2331
|
+
|
|
2332
|
+
```js
|
|
2333
|
+
import { DataTableRow } from '@dhis2/ui'
|
|
2334
|
+
```
|
|
2335
|
+
|
|
2336
|
+
#### Props
|
|
2337
|
+
|
|
2338
|
+
| Name | Type | Default | Required | Description |
|
|
2339
|
+
| ----------------- | ------- | ----------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2340
|
+
| children | node | | | Should be `<DataTableCell>` or `<DataTableCellHead>` components |
|
|
2341
|
+
| className | string | | | |
|
|
2342
|
+
| dataTest | string | `'dhis2-uicore-datatablerow'` | | |
|
|
2343
|
+
| draggable | boolean | | | Renders and additional table cell with drag icon and applies draggable styles |
|
|
2344
|
+
| expandableContent | custom | | | This content will be rendered into an additional row with fullwidth cell and the presence of this prop will display an additional table cell with expand icon |
|
|
2345
|
+
| expanded | boolean | | | Toggles expand icon (up/down) and expandable content visibility |
|
|
2346
|
+
| role | string | | | |
|
|
2347
|
+
| selected | boolean | | | Adds a green background color |
|
|
2348
|
+
| onExpandToggle | custom | | | Callback for expand icon cell clicks |
|
|
2349
|
+
|
|
2350
|
+
### TableBody
|
|
2351
|
+
|
|
2352
|
+
#### Usage
|
|
2353
|
+
|
|
2354
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2355
|
+
|
|
2356
|
+
```js
|
|
2357
|
+
import { TableBody } from '@dhis2/ui'
|
|
2358
|
+
```
|
|
2359
|
+
|
|
2360
|
+
#### Props
|
|
2361
|
+
|
|
2362
|
+
| Name | Type | Default | Required | Description |
|
|
2363
|
+
| --------- | ------- | -------------------------- | -------- | --------------------------------- |
|
|
2364
|
+
| children | node | | | Should be `<TableRow>` components |
|
|
2365
|
+
| className | string | | | |
|
|
2366
|
+
| dataTest | string | `'dhis2-uicore-tablebody'` | | |
|
|
2367
|
+
| loading | boolean | | | |
|
|
2368
|
+
| role | string | | | |
|
|
2369
|
+
|
|
2370
|
+
### TableFoot
|
|
2371
|
+
|
|
2372
|
+
#### Usage
|
|
2373
|
+
|
|
2374
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2375
|
+
|
|
2376
|
+
```js
|
|
2377
|
+
import { TableFoot } from '@dhis2/ui'
|
|
2378
|
+
```
|
|
2379
|
+
|
|
2380
|
+
#### Props
|
|
2381
|
+
|
|
2382
|
+
| Name | Type | Default | Required | Description |
|
|
2383
|
+
| --------- | ------ | -------------------------- | -------- | --------------------------------- |
|
|
2384
|
+
| children | node | | | Should be `<TableRow>` components |
|
|
2385
|
+
| className | string | | | |
|
|
2386
|
+
| dataTest | string | `'dhis2-uicore-tablefoot'` | | |
|
|
2387
|
+
| role | string | | | |
|
|
2388
|
+
|
|
2389
|
+
### TableHead
|
|
2390
|
+
|
|
2391
|
+
#### Usage
|
|
2392
|
+
|
|
2393
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2394
|
+
|
|
2395
|
+
```js
|
|
2396
|
+
import { TableHead } from '@dhis2/ui'
|
|
2397
|
+
```
|
|
2398
|
+
|
|
2399
|
+
#### Props
|
|
2400
|
+
|
|
2401
|
+
| Name | Type | Default | Required | Description |
|
|
2402
|
+
| --------- | ------ | -------------------------- | -------- | ------------------------------------- |
|
|
2403
|
+
| children | node | | | Should be `<TableRowHead>` components |
|
|
2404
|
+
| className | string | | | |
|
|
2405
|
+
| dataTest | string | `'dhis2-uicore-tablehead'` | | |
|
|
2406
|
+
| role | string | | | |
|
|
2407
|
+
|
|
2408
|
+
### TableRow
|
|
2409
|
+
|
|
2410
|
+
#### Usage
|
|
2411
|
+
|
|
2412
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2413
|
+
|
|
2414
|
+
```js
|
|
2415
|
+
import { TableRow } from '@dhis2/ui'
|
|
2416
|
+
```
|
|
2417
|
+
|
|
2418
|
+
#### Props
|
|
2419
|
+
|
|
2420
|
+
| Name | Type | Default | Required | Description |
|
|
2421
|
+
| --------- | ------- | ------------------------- | -------- | --------------------------------------------------------------- |
|
|
2422
|
+
| children | node | | | Should be `<TableDataCell>` or `<TableDataCellHead>` components |
|
|
2423
|
+
| className | string | | | |
|
|
2424
|
+
| dataTest | string | `'dhis2-uicore-tablerow'` | | |
|
|
2425
|
+
| draggable | boolean | | | Applies draggable cursor styles |
|
|
2426
|
+
| role | string | | | |
|
|
2427
|
+
| selected | boolean | | | Sets a selected (teal) background color |
|
|
2428
|
+
|
|
2429
|
+
### Table
|
|
2430
|
+
|
|
2431
|
+
#### Usage
|
|
2432
|
+
|
|
2433
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2434
|
+
|
|
2435
|
+
```js
|
|
2436
|
+
import { Table } from '@dhis2/ui'
|
|
2437
|
+
```
|
|
2438
|
+
|
|
2439
|
+
#### Props
|
|
2440
|
+
|
|
2441
|
+
| Name | Type | Default | Required | Description |
|
|
2442
|
+
| ---------- | ---------------------------------------- | ---------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2443
|
+
| borderless | boolean | | | Removes border from the table |
|
|
2444
|
+
| children | node | | | Should be `<TableHead>`, `<TableBody>`, and `<TableFoot>` components |
|
|
2445
|
+
| className | string | | | |
|
|
2446
|
+
| dataTest | string | `'dhis2-uicore-table'` | | |
|
|
2447
|
+
| layout | 'auto' │ 'fixed' │ 'initial' │ 'inherit' | `'auto'` | | Sets the `table-layout` property. Switching to `fixed` can prevent style<br/>issues when dealing with a table with multiple frozen columns or when dealing<br/>with filter elements in the table headers. |
|
|
2448
|
+
| role | string | | | |
|
|
2449
|
+
| width | string | `'100%'` | | Sets the `width` property. Providing an explicit width can prevent style<br/>issues when dealing with horizontally scrolling tables with a fixed layout. |
|
|
2450
|
+
|
|
2451
|
+
### Tag
|
|
2452
|
+
|
|
2453
|
+
#### Usage
|
|
2454
|
+
|
|
2455
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2456
|
+
|
|
2457
|
+
```js
|
|
2458
|
+
import { Tag } from '@dhis2/ui'
|
|
2459
|
+
```
|
|
2460
|
+
|
|
2461
|
+
#### Props
|
|
2462
|
+
|
|
2463
|
+
| Name | Type | Default | Required | Description |
|
|
2464
|
+
| --------- | ------- | -------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2465
|
+
| bold | boolean | | | Use bold tags where it is important that the tag is seen by the user in an information dense interface. Bold tags should be reserved for edge cases and not overused. |
|
|
2466
|
+
| children | string | | | |
|
|
2467
|
+
| className | string | | | |
|
|
2468
|
+
| dataTest | string | `'dhis2-uicore-tag'` | | |
|
|
2469
|
+
| icon | node | | | Tags can contain icons. Use icons where they will help users easily identify the content of the tag. Tags must have a text label and cannot display only an icon. |
|
|
2470
|
+
| maxWidth | string | `'240px'` | | |
|
|
2471
|
+
| negative | custom | | | Red 'negative' tags imply an error or a problem. `neutral`, `positive`, and `negative` are mutually exclusive props |
|
|
2472
|
+
| neutral | custom | | | Blue 'neutral' tags are used when a tag _could_ have valid or error status but is currently neutral. `neutral`, `positive`, and `negative` are mutually exclusive props |
|
|
2473
|
+
| positive | custom | | | Green 'valid' tags should be used to indicate validity or success. `neutral`, `positive`, and `negative` are mutually exclusive props |
|
|
2474
|
+
|
|
2475
|
+
### TextArea
|
|
2476
|
+
|
|
2477
|
+
#### Usage
|
|
2478
|
+
|
|
2479
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2480
|
+
|
|
2481
|
+
```js
|
|
2482
|
+
import { TextArea } from '@dhis2/ui'
|
|
2483
|
+
```
|
|
2484
|
+
|
|
2485
|
+
#### Props
|
|
2486
|
+
|
|
2487
|
+
| Name | Type | Default | Required | Description |
|
|
2488
|
+
| ------------ | ------------------------------------------- | ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
2489
|
+
| autoGrow | boolean | | | Grow the text area in response to overflow instead of adding a scroll bar |
|
|
2490
|
+
| className | string | | | |
|
|
2491
|
+
| dataTest | string | `'dhis2-uicore-textarea'` | | |
|
|
2492
|
+
| dense | boolean | | | Compact mode |
|
|
2493
|
+
| disabled | boolean | | | Disables the textarea and makes in non-interactive |
|
|
2494
|
+
| error | custom | | | Applies 'error' styles for validation feedback. Mutually exclusive with `valid` and `warning` props |
|
|
2495
|
+
| initialFocus | boolean | | | Grabs initial focus on the page |
|
|
2496
|
+
| loading | boolean | | | Adds a loading spinner |
|
|
2497
|
+
| name | string | | | Name associated with the text area. Passed in object argument to event handlers. |
|
|
2498
|
+
| placeholder | string | | | Placeholder text for an empty textarea |
|
|
2499
|
+
| readOnly | boolean | | | Makes the textarea read-only |
|
|
2500
|
+
| resize | 'none' │ 'both' │ 'horizontal' │ 'vertical' | `'vertical'` | | [Resize property](https://developer.mozilla.org/en-US/docs/Web/CSS/resize) for the textarea element |
|
|
2501
|
+
| rows | number | `4` | | Initial height of the textarea, in lines of text |
|
|
2502
|
+
| tabIndex | string | | | |
|
|
2503
|
+
| valid | custom | | | Applies 'valid' styles for validation feedback. Mutually exclusive with `warning` and `error` props |
|
|
2504
|
+
| value | string | | | Value in the textarea. Can be used to control component (recommended). Passed in object argument to event handlers. |
|
|
2505
|
+
| warning | custom | | | Applies 'warning' styles for validation feedback. Mutually exclusive with `valid` and `error` props |
|
|
2506
|
+
| width | string | `'100%'` | | Width of the text area. Can be any valid CSS measurement |
|
|
2507
|
+
| onBlur | function | | | Called with signature ({ name: string, value: string }, event) |
|
|
2508
|
+
| onChange | function | | | Called with signature ({ name: string, value: string }, event) |
|
|
2509
|
+
| onFocus | function | | | Called with signature ({ name: string, value: string }, event) |
|
|
2510
|
+
|
|
2511
|
+
### TextAreaField
|
|
2512
|
+
|
|
2513
|
+
#### Usage
|
|
2514
|
+
|
|
2515
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2516
|
+
|
|
2517
|
+
```js
|
|
2518
|
+
import { TextAreaField } from '@dhis2/ui'
|
|
2519
|
+
```
|
|
2520
|
+
|
|
2521
|
+
#### Props
|
|
2522
|
+
|
|
2523
|
+
| Name | Type | Default | Required | Description |
|
|
2524
|
+
| -------------- | ------------------------------------------- | --------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
2525
|
+
| autoGrow | boolean | | | Grow the text area in response to overflow instead of adding a scroll bar |
|
|
2526
|
+
| className | string | | | |
|
|
2527
|
+
| dataTest | string | `'dhis2-uiwidgets-textareafield'` | | |
|
|
2528
|
+
| dense | boolean | | | Compact mode |
|
|
2529
|
+
| disabled | boolean | | | Disables the textarea and makes in non-interactive |
|
|
2530
|
+
| error | custom | | | Applies 'error' styles for validation feedback. Mutually exclusive with `valid` and `warning` props |
|
|
2531
|
+
| helpText | string | | | Adds useful help text below the textarea |
|
|
2532
|
+
| initialFocus | boolean | | | Grabs initial focus on the page |
|
|
2533
|
+
| inputWidth | string | | | Sets the width of the textarea. Minimum 220px. Any valid CSS measurement can be used |
|
|
2534
|
+
| label | string | | | Labels the textarea |
|
|
2535
|
+
| loading | boolean | | | Adds a loading spinner |
|
|
2536
|
+
| name | string | | | Name associated with the text area. Passed in object argument to event handlers. |
|
|
2537
|
+
| placeholder | string | | | Placeholder text for an empty textarea |
|
|
2538
|
+
| readOnly | boolean | | | Makes the textarea read-only |
|
|
2539
|
+
| required | boolean | | | Adds an asterisk to the label to indicate this field is required |
|
|
2540
|
+
| resize | 'none' │ 'both' │ 'horizontal' │ 'vertical' | `'vertical'` | | [Resize property](https://developer.mozilla.org/en-US/docs/Web/CSS/resize) for the textarea element |
|
|
2541
|
+
| rows | number | `4` | | Initial height of the textarea, in lines of text |
|
|
2542
|
+
| tabIndex | string | | | |
|
|
2543
|
+
| valid | custom | | | Applies 'valid' styles for validation feedback. Mutually exclusive with `warning` and `error` props |
|
|
2544
|
+
| validationText | string | | | Validation text below the textarea to provide validation feedback. Changes appearance depending on validation status |
|
|
2545
|
+
| value | string | | | Value in the textarea. Can be used to control component (recommended). Passed in object argument to event handlers. |
|
|
2546
|
+
| warning | custom | | | Applies 'warning' styles for validation feedback. Mutually exclusive with `valid` and `error` props |
|
|
2547
|
+
| onBlur | function | | | Called with signature ({ name: string, value: string }, event) |
|
|
2548
|
+
| onChange | function | | | Called with signature ({ name: string, value: string }, event) |
|
|
2549
|
+
| onFocus | function | | | Called with signature ({ name: string, value: string }, event) |
|
|
2550
|
+
|
|
2551
|
+
### Tooltip
|
|
2552
|
+
|
|
2553
|
+
#### Usage
|
|
2554
|
+
|
|
2555
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2556
|
+
|
|
2557
|
+
```js
|
|
2558
|
+
import { Tooltip } from '@dhis2/ui'
|
|
2559
|
+
```
|
|
2560
|
+
|
|
2561
|
+
#### Props
|
|
2562
|
+
|
|
2563
|
+
| Name | Type | Default | Required | Description |
|
|
2564
|
+
| ---------- | ----------------------------------- | ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2565
|
+
| children | node │ function | | | If child is a function, it's called with `{ onMouseOver, onMouseOut, ref }` args to apply to a reference element. If child is a node, it is wrapped in a `span` with the appropriate attributes and handlers. |
|
|
2566
|
+
| className | string | | | |
|
|
2567
|
+
| closeDelay | number | `200` | | Time (in ms) until tooltip closes after mouse out |
|
|
2568
|
+
| content | node | | | Content to display when the tooltip is open |
|
|
2569
|
+
| dataTest | string | `'dhis2-uicore-tooltip'` | | |
|
|
2570
|
+
| maxWidth | number | `300` | | Max width of the tooltip in px |
|
|
2571
|
+
| openDelay | number | `200` | | Time (in ms) until tooltip open after mouse over |
|
|
2572
|
+
| placement | 'top' │ 'right' │ 'bottom' │ 'left' | `'top'` | | Where to place the tooltip relative to its reference |
|
|
2573
|
+
|
|
2574
|
+
### TransferOption
|
|
2575
|
+
|
|
2576
|
+
#### Usage
|
|
2577
|
+
|
|
2578
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2579
|
+
|
|
2580
|
+
```js
|
|
2581
|
+
import { TransferOption } from '@dhis2/ui'
|
|
2582
|
+
```
|
|
2583
|
+
|
|
2584
|
+
#### Props
|
|
2585
|
+
|
|
2586
|
+
| Name | Type | Default | Required | Description |
|
|
2587
|
+
| ------------- | -------- | ------------------------------- | -------- | ----------- |
|
|
2588
|
+
| label | node | | \* | |
|
|
2589
|
+
| value | string | | \* | |
|
|
2590
|
+
| className | string | | | |
|
|
2591
|
+
| dataTest | string | `'dhis2-uicore-transferoption'` | | |
|
|
2592
|
+
| disabled | boolean | | | |
|
|
2593
|
+
| highlighted | boolean | | | |
|
|
2594
|
+
| onClick | function | | | |
|
|
2595
|
+
| onDoubleClick | function | | | |
|
|
2596
|
+
|
|
2597
|
+
### Transfer
|
|
2598
|
+
|
|
2599
|
+
#### Usage
|
|
2600
|
+
|
|
2601
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2602
|
+
|
|
2603
|
+
```js
|
|
2604
|
+
import { Transfer } from '@dhis2/ui'
|
|
2605
|
+
```
|
|
2606
|
+
|
|
2607
|
+
#### Props
|
|
2608
|
+
|
|
2609
|
+
| Name | Type | Default | Required | Description |
|
|
2610
|
+
| ----------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------- | -------- | ----------- |
|
|
2611
|
+
| options | arrayOf({<br/> "label": "string",<br/> "value": "string",<br/> "disabled": "boolean"<br/>}) | | \* | |
|
|
2612
|
+
| onChange | function | | \* | |
|
|
2613
|
+
| addAllText | string | | | |
|
|
2614
|
+
| addIndividualText | string | | | |
|
|
2615
|
+
| className | string | | | |
|
|
2616
|
+
| dataTest | string | `'dhis2-uicore-transfer'` | | |
|
|
2617
|
+
| disabled | boolean | | | |
|
|
2618
|
+
| enableOrderChange | boolean | | | |
|
|
2619
|
+
| filterCallback | function | `defaultFilterCallback` | | |
|
|
2620
|
+
| filterCallbackPicked | function | `defaultFilterCallback` | | |
|
|
2621
|
+
| filterLabel | string | | | |
|
|
2622
|
+
| filterLabelPicked | string | | | |
|
|
2623
|
+
| filterPlaceholder | string | | | |
|
|
2624
|
+
| filterPlaceholderPicked | string | | | |
|
|
2625
|
+
| filterable | boolean | | | |
|
|
2626
|
+
| filterablePicked | boolean | | | |
|
|
2627
|
+
| height | string | `'240px'` | | |
|
|
2628
|
+
| hideFilterInput | boolean | | | |
|
|
2629
|
+
| hideFilterInputPicked | boolean | | | |
|
|
2630
|
+
| initialSearchTerm | string | `''` | | |
|
|
2631
|
+
| initialSearchTermPicked | string | `''` | | |
|
|
2632
|
+
| leftFooter | node | | | |
|
|
2633
|
+
| leftHeader | node | | | |
|
|
2634
|
+
| loading | boolean | | | |
|
|
2635
|
+
| loadingPicked | boolean | | | |
|
|
2636
|
+
| maxSelections | 1 │ Infinity | `Infinity` | | |
|
|
2637
|
+
| optionsWidth | string | `'320px'` | | |
|
|
2638
|
+
| removeAllText | string | | | |
|
|
2639
|
+
| removeIndividualText | string | | | |
|
|
2640
|
+
| renderOption | function | `(option) => <TransferOption {...option} />` | | |
|
|
2641
|
+
| rightFooter | node | | | |
|
|
2642
|
+
| rightHeader | node | | | |
|
|
2643
|
+
| searchTerm | string | | | |
|
|
2644
|
+
| searchTermPicked | string | | | |
|
|
2645
|
+
| selected | arrayOf(string) | `[]` | | |
|
|
2646
|
+
| selectedEmptyComponent | node | | | |
|
|
2647
|
+
| selectedWidth | string | `'320px'` | | |
|
|
2648
|
+
| sourceEmptyPlaceholder | node | | | |
|
|
2649
|
+
| onEndReached | function | | | |
|
|
2650
|
+
| onEndReachedPicked | function | | | |
|
|
2651
|
+
| onFilterChange | function | | | |
|
|
2652
|
+
| onFilterChangePicked | function | | | |
|
|
2653
|
+
|
|
2654
|
+
### UserAvatar
|
|
2655
|
+
|
|
2656
|
+
#### Usage
|
|
2657
|
+
|
|
2658
|
+
**Note**: If possible, import the component from the main UI (`@dhis2/ui`) package.
|
|
2659
|
+
|
|
2660
|
+
```js
|
|
2661
|
+
import { UserAvatar } from '@dhis2/ui'
|
|
2662
|
+
```
|
|
2663
|
+
|
|
2664
|
+
#### Props
|
|
2665
|
+
|
|
2666
|
+
| Name | Type | Default | Required | Description |
|
|
2667
|
+
| ---------- | ------ | --------------------------- | -------- | ----------- |
|
|
2668
|
+
| name | string | | \* | |
|
|
2669
|
+
| avatarId | string | | | |
|
|
2670
|
+
| className | string | | | |
|
|
2671
|
+
| dataTest | string | `'dhis2-uicore-useravatar'` | | |
|
|
2672
|
+
| extralarge | custom | | | |
|
|
2673
|
+
| extrasmall | custom | | | |
|
|
2674
|
+
| large | custom | | | |
|
|
2675
|
+
| medium | custom | | | |
|
|
2676
|
+
| small | custom | | | |
|