@dhis2/ui 8.16.0-alpha.2 → 8.16.0

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