@iress-oss/ids-mcp-server 5.15.0 → 5.20.1

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.
Files changed (132) hide show
  1. package/generated/docs/components_components-alert-docs.md +492 -0
  2. package/generated/docs/components_components-autocomplete-docs.md +3485 -0
  3. package/generated/docs/{components-autocomplete-recipes-docs.md → components_components-autocomplete-recipes-docs.md} +32 -14
  4. package/generated/docs/{components-badge-docs.md → components_components-badge-docs.md} +222 -30
  5. package/generated/docs/components_components-button-docs.md +2078 -0
  6. package/generated/docs/components_components-button-recipes-docs.md +37 -0
  7. package/generated/docs/components_components-buttongroup-docs.md +1045 -0
  8. package/generated/docs/components_components-card-docs.md +2276 -0
  9. package/generated/docs/{components-card-recipes-docs.md → components_components-card-recipes-docs.md} +131 -14
  10. package/generated/docs/components_components-checkbox-docs.md +1054 -0
  11. package/generated/docs/{components-checkboxgroup-docs.md → components_components-checkboxgroup-docs.md} +1000 -81
  12. package/generated/docs/{components-checkboxgroup-recipes-docs.md → components_components-checkboxgroup-recipes-docs.md} +101 -11
  13. package/generated/docs/{components-col-docs.md → components_components-col-docs.md} +331 -58
  14. package/generated/docs/components_components-combobox-docs.md +3767 -0
  15. package/generated/docs/{components-container-docs.md → components_components-container-docs.md} +61 -24
  16. package/generated/docs/{components-divider-docs.md → components_components-divider-docs.md} +83 -24
  17. package/generated/docs/{components-expander-docs.md → components_components-expander-docs.md} +264 -33
  18. package/generated/docs/{components-field-docs.md → components_components-field-docs.md} +814 -120
  19. package/generated/docs/components_components-filter-docs.md +4080 -0
  20. package/generated/docs/{components-form-docs.md → components_components-form-docs.md} +1515 -353
  21. package/generated/docs/{components-form-recipes-docs.md → components_components-form-recipes-docs.md} +170 -54
  22. package/generated/docs/components_components-hide-docs.md +293 -0
  23. package/generated/docs/components_components-icon-docs.md +1337 -0
  24. package/generated/docs/{components-inline-docs.md → components_components-inline-docs.md} +462 -42
  25. package/generated/docs/components_components-input-docs.md +1468 -0
  26. package/generated/docs/components_components-input-recipes-docs.md +367 -0
  27. package/generated/docs/components_components-inputcurrency-docs.md +432 -0
  28. package/generated/docs/{components-inputcurrency-recipes-docs.md → components_components-inputcurrency-recipes-docs.md} +110 -17
  29. package/generated/docs/components_components-label-docs.md +323 -0
  30. package/generated/docs/components_components-menu-docs.md +2345 -0
  31. package/generated/docs/components_components-menu-menuitem-docs.md +633 -0
  32. package/generated/docs/{components-modal-docs.md → components_components-modal-docs.md} +1625 -232
  33. package/generated/docs/components_components-navbar-docs.md +1847 -0
  34. package/generated/docs/{components-navbar-recipes-docs.md → components_components-navbar-recipes-docs.md} +697 -39
  35. package/generated/docs/{components-panel-docs.md → components_components-panel-docs.md} +754 -57
  36. package/generated/docs/components_components-placeholder-docs.md +92 -0
  37. package/generated/docs/components_components-popover-docs.md +1641 -0
  38. package/generated/docs/{components-popover-recipes-docs.md → components_components-popover-recipes-docs.md} +347 -17
  39. package/generated/docs/components_components-progress-docs.md +115 -0
  40. package/generated/docs/{components-provider-docs.md → components_components-provider-docs.md} +41 -32
  41. package/generated/docs/components_components-radio-docs.md +491 -0
  42. package/generated/docs/{components-radiogroup-docs.md → components_components-radiogroup-docs.md} +943 -75
  43. package/generated/docs/components_components-readonly-docs.md +263 -0
  44. package/generated/docs/components_components-richselect-docs.md +6497 -0
  45. package/generated/docs/{components-row-docs.md → components_components-row-docs.md} +353 -43
  46. package/generated/docs/{components-select-docs.md → components_components-select-docs.md} +719 -61
  47. package/generated/docs/components_components-skeleton-docs.md +480 -0
  48. package/generated/docs/{components-skeleton-recipes-docs.md → components_components-skeleton-recipes-docs.md} +50 -10
  49. package/generated/docs/{components-skiplink-docs.md → components_components-skiplink-docs.md} +53 -14
  50. package/generated/docs/components_components-slideout-docs.md +2262 -0
  51. package/generated/docs/components_components-slider-docs.md +1276 -0
  52. package/generated/docs/components_components-spinner-docs.md +82 -0
  53. package/generated/docs/{components-stack-docs.md → components_components-stack-docs.md} +223 -40
  54. package/generated/docs/components_components-table-docs.md +3651 -0
  55. package/generated/docs/components_components-tabset-docs.md +772 -0
  56. package/generated/docs/components_components-tabset-tab-docs.md +262 -0
  57. package/generated/docs/components_components-tag-docs.md +259 -0
  58. package/generated/docs/{components-text-docs.md → components_components-text-docs.md} +491 -51
  59. package/generated/docs/{components-toaster-docs.md → components_components-toaster-docs.md} +181 -79
  60. package/generated/docs/components_components-toaster-toast-docs.md +634 -0
  61. package/generated/docs/components_components-toggle-docs.md +461 -0
  62. package/generated/docs/{components-tooltip-docs.md → components_components-tooltip-docs.md} +286 -41
  63. package/generated/docs/{components-validationmessage-docs.md → components_components-validationmessage-docs.md} +230 -61
  64. package/generated/docs/components_contact-us-docs.md +12 -0
  65. package/generated/docs/{foundations-accessibility-docs.md → components_foundations-accessibility-docs.md} +11 -21
  66. package/generated/docs/{foundations-colours-docs.md → components_foundations-colour-030-colours.md} +8 -15
  67. package/generated/docs/{foundations-consistency-docs.md → components_foundations-consistency-docs.md} +12 -20
  68. package/generated/docs/{foundations-content-docs.md → components_foundations-content-docs.md} +6 -11
  69. package/generated/docs/components_foundations-introduction-docs.md +15 -0
  70. package/generated/docs/{foundations-principles-docs.md → components_foundations-principles-docs.md} +14 -24
  71. package/generated/docs/components_foundations-typography-docs.md +608 -0
  72. package/generated/docs/{foundations-user-experience-docs.md → components_foundations-user-experience-docs.md} +16 -26
  73. package/generated/docs/{foundations-visual-design-docs.md → components_foundations-visual-design-docs.md} +10 -17
  74. package/generated/docs/{frequently-asked-questions-docs.md → components_frequently-asked-questions-docs.md} +14 -23
  75. package/generated/docs/components_get-started-develop-docs.md +84 -0
  76. package/generated/docs/components_get-started-using-storybook-docs.md +55 -0
  77. package/generated/docs/components_introduction-docs.md +15 -0
  78. package/generated/docs/{patterns-loading-docs.md → components_patterns-loading-docs.md} +711 -143
  79. package/generated/docs/components_resources-changelog-docs.md +4 -0
  80. package/generated/docs/{resources-code-katas-docs.md → components_resources-code-katas-docs.md} +5 -9
  81. package/generated/docs/{resources-migration-guides-from-v4-to-v5-docs.md → components_resources-migration-guides-from-v4-to-v5-docs.md} +54 -239
  82. package/generated/docs/{versions-docs.md → components_versions-docs.md} +5 -8
  83. package/generated/docs/guidelines.md +484 -200
  84. package/generated/docs/introduction-docs.md +19 -30
  85. package/package.json +41 -45
  86. package/generated/docs/components-alert-docs.md +0 -130
  87. package/generated/docs/components-autocomplete-docs.md +0 -754
  88. package/generated/docs/components-button-docs.md +0 -362
  89. package/generated/docs/components-button-recipes-docs.md +0 -76
  90. package/generated/docs/components-buttongroup-docs.md +0 -310
  91. package/generated/docs/components-card-docs.md +0 -494
  92. package/generated/docs/components-checkbox-docs.md +0 -193
  93. package/generated/docs/components-combobox-docs.md +0 -1016
  94. package/generated/docs/components-filter-docs.md +0 -1109
  95. package/generated/docs/components-hide-docs.md +0 -265
  96. package/generated/docs/components-icon-docs.md +0 -553
  97. package/generated/docs/components-input-docs.md +0 -335
  98. package/generated/docs/components-input-recipes-docs.md +0 -140
  99. package/generated/docs/components-inputcurrency-docs.md +0 -157
  100. package/generated/docs/components-label-docs.md +0 -135
  101. package/generated/docs/components-menu-docs.md +0 -704
  102. package/generated/docs/components-menu-menuitem-docs.md +0 -193
  103. package/generated/docs/components-navbar-docs.md +0 -291
  104. package/generated/docs/components-placeholder-docs.md +0 -27
  105. package/generated/docs/components-popover-docs.md +0 -464
  106. package/generated/docs/components-progress-docs.md +0 -104
  107. package/generated/docs/components-radio-docs.md +0 -107
  108. package/generated/docs/components-readonly-docs.md +0 -89
  109. package/generated/docs/components-richselect-docs.md +0 -2433
  110. package/generated/docs/components-skeleton-docs.md +0 -214
  111. package/generated/docs/components-slideout-docs.md +0 -538
  112. package/generated/docs/components-slider-docs.md +0 -346
  113. package/generated/docs/components-spinner-docs.md +0 -59
  114. package/generated/docs/components-table-ag-grid-docs.md +0 -1074
  115. package/generated/docs/components-table-docs.md +0 -1305
  116. package/generated/docs/components-tabset-docs.md +0 -341
  117. package/generated/docs/components-tabset-tab-docs.md +0 -86
  118. package/generated/docs/components-tag-docs.md +0 -115
  119. package/generated/docs/components-toaster-toast-docs.md +0 -157
  120. package/generated/docs/components-toggle-docs.md +0 -158
  121. package/generated/docs/contact-us-docs.md +0 -27
  122. package/generated/docs/extensions-editor-docs.md +0 -288
  123. package/generated/docs/extensions-editor-recipes-docs.md +0 -39
  124. package/generated/docs/foundations-introduction-docs.md +0 -17
  125. package/generated/docs/foundations-typography-docs.md +0 -191
  126. package/generated/docs/get-started-develop-docs.md +0 -209
  127. package/generated/docs/get-started-using-storybook-docs.md +0 -68
  128. package/generated/docs/resources-changelog-docs.md +0 -6
  129. package/generated/docs/themes-available-themes-docs.md +0 -66
  130. package/generated/docs/themes-introduction-docs.md +0 -121
  131. package/generated/docs/themes-tokens-docs.md +0 -1200
  132. /package/{LICENSE.txt → LICENSE} +0 -0
@@ -0,0 +1,3485 @@
1
+ Autocomplete
2
+ ============
3
+
4
+ Overview
5
+ --------
6
+
7
+ Autocomplete allow for users to fill in their input by providing suggestions as they type.
8
+
9
+ [](./iframe.html?id=components-autocomplete--default)
10
+
11
+ ```
12
+
13
+ <IressAutocomplete
14
+ options\={\[
15
+ {
16
+ label: 'Option 1'
17
+ },
18
+ {
19
+ label: 'Option 2'
20
+ },
21
+ {
22
+ label: 'Option 3'
23
+ },
24
+ {
25
+ label: 'Option 4'
26
+ },
27
+ {
28
+ label: 'Option 5'
29
+ }
30
+ \]}
31
+ popoverProps\={{
32
+ container: {}
33
+ }}
34
+ />
35
+
36
+ ```
37
+
38
+ Props
39
+ -----
40
+
41
+ | Name | Description | Default | Control |
42
+ | --- | --- | --- | --- |
43
+ | alwaysShowOnFocus |
44
+ Always shown on focus, even if the user has not interacted with the input.
45
+
46
+ boolean
47
+
48
+
49
+
50
+ | \- | Set boolean |
51
+ | append |
52
+
53
+ Append content.
54
+
55
+ ReactNode
56
+
57
+
58
+
59
+ |
60
+
61
+ <IressIcon />
62
+
63
+
64
+
65
+ | Set object |
66
+ | autoComplete |
67
+
68
+ |
69
+
70
+ 'off'
71
+
72
+ | Set object |
73
+ | autoSelect |
74
+
75
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
76
+
77
+ boolean
78
+
79
+
80
+
81
+ |
82
+
83
+ true
84
+
85
+ | Set boolean |
86
+ | clearable |
87
+
88
+ If `true`, then user can clear the value of the input.
89
+
90
+ boolean
91
+
92
+
93
+
94
+ |
95
+
96
+ true
97
+
98
+ | Set boolean |
99
+ | errorText |
100
+
101
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
102
+
103
+ ReactNode
104
+
105
+
106
+
107
+ |
108
+
109
+ <IressAlert />
110
+
111
+
112
+
113
+ | Set object |
114
+ | limitDesktop |
115
+
116
+ |
117
+
118
+ 12
119
+
120
+ | Set object |
121
+ | limitMobile |
122
+
123
+ |
124
+
125
+ 6
126
+
127
+ | Set object |
128
+ | noResultsText |
129
+
130
+ Text to be displayed when no results are found.
131
+
132
+ ReactNode
133
+
134
+
135
+
136
+ | \- | Set object |
137
+ | onChange |
138
+
139
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
140
+
141
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
142
+
143
+ | \- | \- |
144
+ | options |
145
+
146
+ array
147
+
148
+
149
+
150
+ | \- |
151
+
152
+ RAW
153
+
154
+ * options :
155
+
156
+ \[
157
+
158
+ * 0 :
159
+
160
+ {...} 1 key
161
+
162
+ * 1 :
163
+
164
+ {...} 1 key
165
+
166
+ * 2 :
167
+
168
+ {...} 1 key
169
+
170
+ * 3 :
171
+
172
+ {...} 1 key
173
+
174
+ * 4 :
175
+
176
+ {...} 1 key
177
+
178
+
179
+ \]
180
+
181
+
182
+
183
+
184
+ |
185
+ | popoverProps |
186
+
187
+ Customise the IressInputPopover props for your needs.
188
+
189
+ AutocompletePopoverProps
190
+
191
+
192
+
193
+ | { } |
194
+
195
+ RAW
196
+
197
+ popoverProps :
198
+
199
+ {
200
+
201
+ }
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ |
210
+ | watermark |
211
+
212
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
213
+
214
+ boolean
215
+
216
+
217
+
218
+ |
219
+
220
+ true
221
+
222
+ | Set boolean |
223
+
224
+ Usage
225
+ -----
226
+
227
+ The `IressAutocomplete` element extends `IressInput` with additional functionality to provide suggestions to the user as they type.
228
+
229
+ There is no validation done between the suggestions and the input value. They are strictly suggestions to improve the user experience. If you would like to restrict the input to the suggestions, you can use `IressCombobox`.
230
+
231
+ ### Uncontrolled
232
+
233
+ The `defaultValue` prop can be used to set the initial value of the input. The value will be managed by the component.
234
+
235
+ [](./iframe.html?id=components-autocomplete--uncontrolled)
236
+
237
+ ×Clear
238
+
239
+ ```
240
+
241
+ <IressAutocomplete
242
+ defaultValue\="Option 1"
243
+ options\={\[
244
+ {
245
+ label: 'Option 1'
246
+ },
247
+ {
248
+ label: 'Option 2'
249
+ },
250
+ {
251
+ label: 'Option 3'
252
+ },
253
+ {
254
+ label: 'Option 4'
255
+ },
256
+ {
257
+ label: 'Option 5'
258
+ }
259
+ \]}
260
+ popoverProps\={{
261
+ container: {}
262
+ }}
263
+ />
264
+
265
+ ```
266
+
267
+ #### Props
268
+
269
+ | Name | Description | Default | Control |
270
+ | --- | --- | --- | --- |
271
+ | alwaysShowOnFocus |
272
+ Always shown on focus, even if the user has not interacted with the input.
273
+
274
+ boolean
275
+
276
+
277
+
278
+ | \- | Set boolean |
279
+ | append |
280
+
281
+ Append content.
282
+
283
+ ReactNode
284
+
285
+
286
+
287
+ |
288
+
289
+ <IressIcon />
290
+
291
+
292
+
293
+ | Set object |
294
+ | autoComplete |
295
+
296
+ |
297
+
298
+ 'off'
299
+
300
+ | Set object |
301
+ | autoSelect |
302
+
303
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
304
+
305
+ boolean
306
+
307
+
308
+
309
+ |
310
+
311
+ true
312
+
313
+ | Set boolean |
314
+ | clearable |
315
+
316
+ If `true`, then user can clear the value of the input.
317
+
318
+ boolean
319
+
320
+
321
+
322
+ |
323
+
324
+ true
325
+
326
+ | Set boolean |
327
+ | defaultValue |
328
+
329
+ string
330
+
331
+
332
+
333
+ | \- | Option 1 |
334
+ | errorText |
335
+
336
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
337
+
338
+ ReactNode
339
+
340
+
341
+
342
+ |
343
+
344
+ <IressAlert />
345
+
346
+
347
+
348
+ | Set object |
349
+ | limitDesktop |
350
+
351
+ |
352
+
353
+ 12
354
+
355
+ | Set object |
356
+ | limitMobile |
357
+
358
+ |
359
+
360
+ 6
361
+
362
+ | Set object |
363
+ | noResultsText |
364
+
365
+ Text to be displayed when no results are found.
366
+
367
+ ReactNode
368
+
369
+
370
+
371
+ | \- | Set object |
372
+ | onChange |
373
+
374
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
375
+
376
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
377
+
378
+ | \- | \- |
379
+ | options |
380
+
381
+ array
382
+
383
+
384
+
385
+ | \- |
386
+
387
+ RAW
388
+
389
+ * options :
390
+
391
+ \[
392
+
393
+ * 0 :
394
+
395
+ {...} 1 key
396
+
397
+ * 1 :
398
+
399
+ {...} 1 key
400
+
401
+ * 2 :
402
+
403
+ {...} 1 key
404
+
405
+ * 3 :
406
+
407
+ {...} 1 key
408
+
409
+ * 4 :
410
+
411
+ {...} 1 key
412
+
413
+
414
+ \]
415
+
416
+
417
+
418
+
419
+ |
420
+ | popoverProps |
421
+
422
+ Customise the IressInputPopover props for your needs.
423
+
424
+ AutocompletePopoverProps
425
+
426
+
427
+
428
+ | { } |
429
+
430
+ RAW
431
+
432
+ popoverProps :
433
+
434
+ {
435
+
436
+ }
437
+
438
+
439
+
440
+
441
+
442
+
443
+
444
+ |
445
+ | watermark |
446
+
447
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
448
+
449
+ boolean
450
+
451
+
452
+
453
+ |
454
+
455
+ true
456
+
457
+ | Set boolean |
458
+
459
+ ### Controlled
460
+
461
+ The `value` prop can be used to completely control the state of the component. Use the `onChange` and `onClear` props to sync your state with the component.
462
+
463
+ [](./iframe.html?id=components-autocomplete--controlled)
464
+
465
+ ×Clear
466
+
467
+ ```
468
+
469
+ import { IressAutocomplete, type IressAutocompleteProps } from '@iress-oss/ids-components';
470
+ import { useState } from 'react';
471
+ export const AutocompleteUsingState \= () \=> {
472
+ const \[value, setValue\] \= useState('Option 1');
473
+ return (
474
+ <IressAutocomplete
475
+ {...{
476
+ popoverProps: {
477
+ container: {},
478
+ },
479
+ options: \[
480
+ {
481
+ label: 'Option 1',
482
+ },
483
+ {
484
+ label: 'Option 2',
485
+ },
486
+ {
487
+ label: 'Option 3',
488
+ },
489
+ {
490
+ label: 'Option 4',
491
+ },
492
+ {
493
+ label: 'Option 5',
494
+ },
495
+ \],
496
+ }}
497
+ onChange\={(\_e, newValue) \=> setValue(newValue ?? '')}
498
+ onClear\={() \=> setValue('')}
499
+ value\={value}
500
+ />
501
+ );
502
+ };
503
+
504
+ ```
505
+
506
+ #### Props
507
+
508
+ | Name | Description | Default | Control |
509
+ | --- | --- | --- | --- |
510
+ | alwaysShowOnFocus |
511
+ Always shown on focus, even if the user has not interacted with the input.
512
+
513
+ boolean
514
+
515
+
516
+
517
+ | \- | Set boolean |
518
+ | append |
519
+
520
+ Append content.
521
+
522
+ ReactNode
523
+
524
+
525
+
526
+ |
527
+
528
+ <IressIcon />
529
+
530
+
531
+
532
+ | Set object |
533
+ | autoComplete |
534
+
535
+ |
536
+
537
+ 'off'
538
+
539
+ | Set object |
540
+ | autoSelect |
541
+
542
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
543
+
544
+ boolean
545
+
546
+
547
+
548
+ |
549
+
550
+ true
551
+
552
+ | Set boolean |
553
+ | clearable |
554
+
555
+ If `true`, then user can clear the value of the input.
556
+
557
+ boolean
558
+
559
+
560
+
561
+ |
562
+
563
+ true
564
+
565
+ | Set boolean |
566
+ | defaultValue |
567
+
568
+ \-
569
+
570
+ | \- | \- |
571
+ | errorText |
572
+
573
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
574
+
575
+ ReactNode
576
+
577
+
578
+
579
+ |
580
+
581
+ <IressAlert />
582
+
583
+
584
+
585
+ | Set object |
586
+ | limitDesktop |
587
+
588
+ |
589
+
590
+ 12
591
+
592
+ | Set object |
593
+ | limitMobile |
594
+
595
+ |
596
+
597
+ 6
598
+
599
+ | Set object |
600
+ | noResultsText |
601
+
602
+ Text to be displayed when no results are found.
603
+
604
+ ReactNode
605
+
606
+
607
+
608
+ | \- | Set object |
609
+ | onChange |
610
+
611
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
612
+
613
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
614
+
615
+ | \- | \- |
616
+ | options |
617
+
618
+ array
619
+
620
+
621
+
622
+ | \- |
623
+
624
+ RAW
625
+
626
+ * options :
627
+
628
+ \[
629
+
630
+ * 0 :
631
+
632
+ {...} 1 key
633
+
634
+ * 1 :
635
+
636
+ {...} 1 key
637
+
638
+ * 2 :
639
+
640
+ {...} 1 key
641
+
642
+ * 3 :
643
+
644
+ {...} 1 key
645
+
646
+ * 4 :
647
+
648
+ {...} 1 key
649
+
650
+
651
+ \]
652
+
653
+
654
+
655
+
656
+ |
657
+ | popoverProps |
658
+
659
+ Customise the IressInputPopover props for your needs.
660
+
661
+ AutocompletePopoverProps
662
+
663
+
664
+
665
+ | { } |
666
+
667
+ RAW
668
+
669
+ popoverProps :
670
+
671
+ {
672
+
673
+ }
674
+
675
+
676
+
677
+
678
+
679
+
680
+
681
+ |
682
+ | value |
683
+
684
+ \-
685
+
686
+ | \- | \- |
687
+ | watermark |
688
+
689
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
690
+
691
+ boolean
692
+
693
+
694
+
695
+ |
696
+
697
+ true
698
+
699
+ | Set boolean |
700
+
701
+ ### Providing suggestions
702
+
703
+ #### `options`
704
+
705
+ To use the suggestion functionality, you can provide an array of `LabelValueMeta[]` objects to the `options` prop.
706
+
707
+ **Note:** If `value` is provided on a suggestion item, it will be used (casted to a string) instead of the `label` key. This is useful when you want to display a different value to the user than what is used for filtering.
708
+
709
+ [](./iframe.html?id=components-autocomplete--options)
710
+
711
+ ```
712
+
713
+ <IressAutocomplete
714
+ options\={\[
715
+ {
716
+ label: 'Option 1'
717
+ },
718
+ {
719
+ label: 'Option 2'
720
+ },
721
+ {
722
+ label: 'Option 3'
723
+ },
724
+ {
725
+ label: 'Option 4'
726
+ },
727
+ {
728
+ label: 'Option 5'
729
+ }
730
+ \]}
731
+ popoverProps\={{
732
+ container: {}
733
+ }}
734
+ />
735
+
736
+ ```
737
+
738
+ #### Props
739
+
740
+ | Name | Description | Default | Control |
741
+ | --- | --- | --- | --- |
742
+ | alwaysShowOnFocus |
743
+ Always shown on focus, even if the user has not interacted with the input.
744
+
745
+ boolean
746
+
747
+
748
+
749
+ | \- | Set boolean |
750
+ | append |
751
+
752
+ Append content.
753
+
754
+ ReactNode
755
+
756
+
757
+
758
+ |
759
+
760
+ <IressIcon />
761
+
762
+
763
+
764
+ | Set object |
765
+ | autoComplete |
766
+
767
+ |
768
+
769
+ 'off'
770
+
771
+ | Set object |
772
+ | autoSelect |
773
+
774
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
775
+
776
+ boolean
777
+
778
+
779
+
780
+ |
781
+
782
+ true
783
+
784
+ | Set boolean |
785
+ | clearable |
786
+
787
+ If `true`, then user can clear the value of the input.
788
+
789
+ boolean
790
+
791
+
792
+
793
+ |
794
+
795
+ true
796
+
797
+ | Set boolean |
798
+ | errorText |
799
+
800
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
801
+
802
+ ReactNode
803
+
804
+
805
+
806
+ |
807
+
808
+ <IressAlert />
809
+
810
+
811
+
812
+ | Set object |
813
+ | limitDesktop |
814
+
815
+ |
816
+
817
+ 12
818
+
819
+ | Set object |
820
+ | limitMobile |
821
+
822
+ |
823
+
824
+ 6
825
+
826
+ | Set object |
827
+ | noResultsText |
828
+
829
+ Text to be displayed when no results are found.
830
+
831
+ ReactNode
832
+
833
+
834
+
835
+ | \- | Set object |
836
+ | onChange |
837
+
838
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
839
+
840
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
841
+
842
+ | \- | \- |
843
+ | options |
844
+
845
+ array
846
+
847
+
848
+
849
+ | \- |
850
+
851
+ RAW
852
+
853
+ * options :
854
+
855
+ \[
856
+
857
+ * 0 :
858
+
859
+ {...} 1 key
860
+
861
+ * 1 :
862
+
863
+ {...} 1 key
864
+
865
+ * 2 :
866
+
867
+ {...} 1 key
868
+
869
+ * 3 :
870
+
871
+ {...} 1 key
872
+
873
+ * 4 :
874
+
875
+ {...} 1 key
876
+
877
+
878
+ \]
879
+
880
+
881
+
882
+
883
+ |
884
+ | popoverProps |
885
+
886
+ Customise the IressInputPopover props for your needs.
887
+
888
+ AutocompletePopoverProps
889
+
890
+
891
+
892
+ | { } |
893
+
894
+ RAW
895
+
896
+ popoverProps :
897
+
898
+ {
899
+
900
+ }
901
+
902
+
903
+
904
+
905
+
906
+
907
+
908
+ |
909
+ | watermark |
910
+
911
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
912
+
913
+ boolean
914
+
915
+
916
+
917
+ |
918
+
919
+ true
920
+
921
+ | Set boolean |
922
+
923
+ #### Asynchronous `options`
924
+
925
+ If you would like to render suggestions from the server, you can pass a function to the `options` prop. It accepts a string parameter and returns a promise that resolves to an array of `LabelValueMeta[]` objects.
926
+
927
+ [](./iframe.html?id=components-autocomplete--async-options)
928
+
929
+ ```
930
+
931
+ import { IressAutocomplete, type IressAutocompleteProps } from '@iress-oss/ids-components';
932
+ interface StarWarsCharacter {
933
+ name: string;
934
+ gender: string;
935
+ }
936
+ interface StarWarsCharacterApi {
937
+ results: StarWarsCharacter\[\];
938
+ }
939
+ export const AutocompleteUsingAsync \= () \=> (
940
+ <IressAutocomplete
941
+ {...{
942
+ popoverProps: {
943
+ container: {},
944
+ },
945
+ }}
946
+ options\={async (query: string) \=> {
947
+ if (query \=== 'error') {
948
+ throw new Error('This is an error');
949
+ }
950
+ const data \= await fetch(
951
+ \`https://swapi.py4e.com/api/people/?search=${query}\`,
952
+ ).then((response) \=> response.json() as Promise<StarWarsCharacterApi\>);
953
+ return data.results.map((character: StarWarsCharacter) \=> ({
954
+ label: character.name,
955
+ value: character.name,
956
+ meta: character.gender,
957
+ }));
958
+ }}
959
+ />
960
+ );
961
+
962
+ ```
963
+
964
+ #### Props
965
+
966
+ | Name | Description | Default | Control |
967
+ | --- | --- | --- | --- |
968
+ | alwaysShowOnFocus |
969
+ Always shown on focus, even if the user has not interacted with the input.
970
+
971
+ boolean
972
+
973
+
974
+
975
+ | \- | Set boolean |
976
+ | append |
977
+
978
+ Append content.
979
+
980
+ ReactNode
981
+
982
+
983
+
984
+ |
985
+
986
+ <IressIcon />
987
+
988
+
989
+
990
+ | Set object |
991
+ | autoComplete |
992
+
993
+ |
994
+
995
+ 'off'
996
+
997
+ | Set object |
998
+ | autoSelect |
999
+
1000
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
1001
+
1002
+ boolean
1003
+
1004
+
1005
+
1006
+ |
1007
+
1008
+ true
1009
+
1010
+ | Set boolean |
1011
+ | clearable |
1012
+
1013
+ If `true`, then user can clear the value of the input.
1014
+
1015
+ boolean
1016
+
1017
+
1018
+
1019
+ |
1020
+
1021
+ true
1022
+
1023
+ | Set boolean |
1024
+ | errorText |
1025
+
1026
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
1027
+
1028
+ ReactNode
1029
+
1030
+
1031
+
1032
+ |
1033
+
1034
+ <IressAlert />
1035
+
1036
+
1037
+
1038
+ | Set object |
1039
+ | limitDesktop |
1040
+
1041
+ |
1042
+
1043
+ 12
1044
+
1045
+ | Set object |
1046
+ | limitMobile |
1047
+
1048
+ |
1049
+
1050
+ 6
1051
+
1052
+ | Set object |
1053
+ | noResultsText |
1054
+
1055
+ Text to be displayed when no results are found.
1056
+
1057
+ ReactNode
1058
+
1059
+
1060
+
1061
+ | \- | Set object |
1062
+ | onChange |
1063
+
1064
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
1065
+
1066
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
1067
+
1068
+ | \- | \- |
1069
+ | options |
1070
+
1071
+ \-
1072
+
1073
+ | \- | \- |
1074
+ | popoverProps |
1075
+
1076
+ Customise the IressInputPopover props for your needs.
1077
+
1078
+ AutocompletePopoverProps
1079
+
1080
+
1081
+
1082
+ | { } |
1083
+
1084
+ RAW
1085
+
1086
+ popoverProps :
1087
+
1088
+ {
1089
+
1090
+ }
1091
+
1092
+
1093
+
1094
+
1095
+
1096
+
1097
+
1098
+ |
1099
+ | watermark |
1100
+
1101
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
1102
+
1103
+ boolean
1104
+
1105
+
1106
+
1107
+ |
1108
+
1109
+ true
1110
+
1111
+ | Set boolean |
1112
+
1113
+ #### Minimum search length for async options
1114
+
1115
+ When using asynchronous options, you can set a minimum number of characters required before triggering the search using the `minSearchLength` prop. This prevents unnecessary API calls and loading states for very short queries.
1116
+
1117
+ By default, async searches are triggered after 1 character. Setting a higher value (e.g., 3) means no search request will be made and no loading spinner will appear until the user types at least that many characters.
1118
+
1119
+ [](./iframe.html?id=components-autocomplete--async-options-min-search-length)
1120
+
1121
+ ```
1122
+
1123
+ import { IressAutocomplete, type IressAutocompleteProps } from '@iress-oss/ids-components';
1124
+ interface StarWarsCharacter {
1125
+ name: string;
1126
+ gender: string;
1127
+ }
1128
+ interface StarWarsCharacterApi {
1129
+ results: StarWarsCharacter\[\];
1130
+ }
1131
+ export const AutocompleteUsingAsync \= () \=> (
1132
+ <IressAutocomplete
1133
+ {...{
1134
+ popoverProps: {
1135
+ container: {},
1136
+ },
1137
+ minSearchLength: 3,
1138
+ }}
1139
+ options\={async (query: string) \=> {
1140
+ if (query \=== 'error') {
1141
+ throw new Error('This is an error');
1142
+ }
1143
+ const data \= await fetch(
1144
+ \`https://swapi.py4e.com/api/people/?search=${query}\`,
1145
+ ).then((response) \=> response.json() as Promise<StarWarsCharacterApi\>);
1146
+ return data.results.map((character: StarWarsCharacter) \=> ({
1147
+ label: character.name,
1148
+ value: character.name,
1149
+ meta: character.gender,
1150
+ }));
1151
+ }}
1152
+ />
1153
+ );
1154
+
1155
+ ```
1156
+
1157
+ #### Props
1158
+
1159
+ | Name | Description | Default | Control |
1160
+ | --- | --- | --- | --- |
1161
+ | alwaysShowOnFocus |
1162
+ Always shown on focus, even if the user has not interacted with the input.
1163
+
1164
+ boolean
1165
+
1166
+
1167
+
1168
+ | \- | Set boolean |
1169
+ | append |
1170
+
1171
+ Append content.
1172
+
1173
+ ReactNode
1174
+
1175
+
1176
+
1177
+ |
1178
+
1179
+ <IressIcon />
1180
+
1181
+
1182
+
1183
+ | Set object |
1184
+ | autoComplete |
1185
+
1186
+ |
1187
+
1188
+ 'off'
1189
+
1190
+ | Set object |
1191
+ | autoSelect |
1192
+
1193
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
1194
+
1195
+ boolean
1196
+
1197
+
1198
+
1199
+ |
1200
+
1201
+ true
1202
+
1203
+ | Set boolean |
1204
+ | clearable |
1205
+
1206
+ If `true`, then user can clear the value of the input.
1207
+
1208
+ boolean
1209
+
1210
+
1211
+
1212
+ |
1213
+
1214
+ true
1215
+
1216
+ | Set boolean |
1217
+ | errorText |
1218
+
1219
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
1220
+
1221
+ ReactNode
1222
+
1223
+
1224
+
1225
+ |
1226
+
1227
+ <IressAlert />
1228
+
1229
+
1230
+
1231
+ | Set object |
1232
+ | limitDesktop |
1233
+
1234
+ |
1235
+
1236
+ 12
1237
+
1238
+ | Set object |
1239
+ | limitMobile |
1240
+
1241
+ |
1242
+
1243
+ 6
1244
+
1245
+ | Set object |
1246
+ | minSearchLength |
1247
+
1248
+ number
1249
+
1250
+
1251
+
1252
+ | \- | |
1253
+ | noResultsText |
1254
+
1255
+ Text to be displayed when no results are found.
1256
+
1257
+ ReactNode
1258
+
1259
+
1260
+
1261
+ | \- | Set object |
1262
+ | onChange |
1263
+
1264
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
1265
+
1266
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
1267
+
1268
+ | \- | \- |
1269
+ | options |
1270
+
1271
+ \-
1272
+
1273
+ | \- | \- |
1274
+ | popoverProps |
1275
+
1276
+ Customise the IressInputPopover props for your needs.
1277
+
1278
+ AutocompletePopoverProps
1279
+
1280
+
1281
+
1282
+ | { } |
1283
+
1284
+ RAW
1285
+
1286
+ popoverProps :
1287
+
1288
+ {
1289
+
1290
+ }
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+
1297
+
1298
+ |
1299
+ | watermark |
1300
+
1301
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
1302
+
1303
+ boolean
1304
+
1305
+
1306
+
1307
+ |
1308
+
1309
+ true
1310
+
1311
+ | Set boolean |
1312
+
1313
+ #### `initialOptions`
1314
+
1315
+ If you want to provide initial options to the user, you can use the `initialOptions` prop. This is useful when you want to provide a list of options to the user before they start typing (eg. recommended search terms).
1316
+
1317
+ [](./iframe.html?id=components-autocomplete--initial-options)
1318
+
1319
+ ```
1320
+
1321
+ <IressAutocomplete
1322
+ initialOptions\={\[
1323
+ {
1324
+ label: 'Favourite option 1'
1325
+ },
1326
+ {
1327
+ label: 'Favourite option 2'
1328
+ },
1329
+ {
1330
+ label: 'Favourite option 3'
1331
+ }
1332
+ \]}
1333
+ options\={\[
1334
+ {
1335
+ label: 'Option 1'
1336
+ },
1337
+ {
1338
+ label: 'Option 2'
1339
+ },
1340
+ {
1341
+ label: 'Option 3'
1342
+ },
1343
+ {
1344
+ label: 'Option 4'
1345
+ },
1346
+ {
1347
+ label: 'Option 5'
1348
+ }
1349
+ \]}
1350
+ popoverProps\={{
1351
+ container: {}
1352
+ }}
1353
+ />
1354
+
1355
+ ```
1356
+
1357
+ #### Props
1358
+
1359
+ | Name | Description | Default | Control |
1360
+ | --- | --- | --- | --- |
1361
+ | alwaysShowOnFocus |
1362
+ Always shown on focus, even if the user has not interacted with the input.
1363
+
1364
+ boolean
1365
+
1366
+
1367
+
1368
+ | \- | Set boolean |
1369
+ | append |
1370
+
1371
+ Append content.
1372
+
1373
+ ReactNode
1374
+
1375
+
1376
+
1377
+ |
1378
+
1379
+ <IressIcon />
1380
+
1381
+
1382
+
1383
+ | Set object |
1384
+ | autoComplete |
1385
+
1386
+ |
1387
+
1388
+ 'off'
1389
+
1390
+ | Set object |
1391
+ | autoSelect |
1392
+
1393
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
1394
+
1395
+ boolean
1396
+
1397
+
1398
+
1399
+ |
1400
+
1401
+ true
1402
+
1403
+ | Set boolean |
1404
+ | clearable |
1405
+
1406
+ If `true`, then user can clear the value of the input.
1407
+
1408
+ boolean
1409
+
1410
+
1411
+
1412
+ |
1413
+
1414
+ true
1415
+
1416
+ | Set boolean |
1417
+ | errorText |
1418
+
1419
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
1420
+
1421
+ ReactNode
1422
+
1423
+
1424
+
1425
+ |
1426
+
1427
+ <IressAlert />
1428
+
1429
+
1430
+
1431
+ | Set object |
1432
+ | initialOptions |
1433
+
1434
+ array
1435
+
1436
+
1437
+
1438
+ | \- |
1439
+
1440
+ RAW
1441
+
1442
+ * initialOptions :
1443
+
1444
+ \[
1445
+
1446
+ * 0 :
1447
+
1448
+ {...} 1 key
1449
+
1450
+ * 1 :
1451
+
1452
+ {...} 1 key
1453
+
1454
+ * 2 :
1455
+
1456
+ {...} 1 key
1457
+
1458
+
1459
+ \]
1460
+
1461
+
1462
+
1463
+
1464
+ |
1465
+ | limitDesktop |
1466
+
1467
+ |
1468
+
1469
+ 12
1470
+
1471
+ | Set object |
1472
+ | limitMobile |
1473
+
1474
+ |
1475
+
1476
+ 6
1477
+
1478
+ | Set object |
1479
+ | noResultsText |
1480
+
1481
+ Text to be displayed when no results are found.
1482
+
1483
+ ReactNode
1484
+
1485
+
1486
+
1487
+ | \- | Set object |
1488
+ | onChange |
1489
+
1490
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
1491
+
1492
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
1493
+
1494
+ | \- | \- |
1495
+ | options |
1496
+
1497
+ array
1498
+
1499
+
1500
+
1501
+ | \- |
1502
+
1503
+ RAW
1504
+
1505
+ * options :
1506
+
1507
+ \[
1508
+
1509
+ * 0 :
1510
+
1511
+ {...} 1 key
1512
+
1513
+ * 1 :
1514
+
1515
+ {...} 1 key
1516
+
1517
+ * 2 :
1518
+
1519
+ {...} 1 key
1520
+
1521
+ * 3 :
1522
+
1523
+ {...} 1 key
1524
+
1525
+ * 4 :
1526
+
1527
+ {...} 1 key
1528
+
1529
+
1530
+ \]
1531
+
1532
+
1533
+
1534
+
1535
+ |
1536
+ | popoverProps |
1537
+
1538
+ Customise the IressInputPopover props for your needs.
1539
+
1540
+ AutocompletePopoverProps
1541
+
1542
+
1543
+
1544
+ | { } |
1545
+
1546
+ RAW
1547
+
1548
+ popoverProps :
1549
+
1550
+ {
1551
+
1552
+ }
1553
+
1554
+
1555
+
1556
+
1557
+
1558
+
1559
+
1560
+ |
1561
+ | watermark |
1562
+
1563
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
1564
+
1565
+ boolean
1566
+
1567
+
1568
+
1569
+ |
1570
+
1571
+ true
1572
+
1573
+ | Set boolean |
1574
+
1575
+ Behaviour
1576
+ ---------
1577
+
1578
+ * As long as there is a single character in the input, the suggestions will be displayed in a popover. Unless `initialOptions` are provided where the popover will be displayed immediately on focus.
1579
+ * The popover will close when the input is empty, unless `initialOptions` are provided.
1580
+ * The suggestions will be filtered based on the input value.
1581
+ * Tapping on a suggestion with the mouse will change the input value to the selection and close the popover.
1582
+ * When the user presses the arrows keys while the input is focussed, suggestions will be highlighted, but focus remains on the input.
1583
+ * When the user presses the enter key while a suggestion is highlighted, the suggestion will be selected and the popover will close.
1584
+ * When the user presses the down key while the popover is closed, it will open the popover.
1585
+ * When the user pressed the up key while the first suggestion is highlighted, it will close the popover.
1586
+ * When the user tabs away while no suggestion is highlighted, the input will not be changed.
1587
+ * When the user tabs away while a suggestion is highlighted, the suggestion will be selected.
1588
+ * When the user tabs away while the popover is open, the popover will close.
1589
+
1590
+ Accessibility
1591
+ -------------
1592
+
1593
+ The autocomplete component follows the [WAI combobox pattern: List autocomplete with manual selection](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/#:~:text=List%20autocomplete%20with%20manual,value%20in%20the%20popup). An example of this pattern outside of IDS can be seen at [WAI-ARIA combobox example](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list/).
1594
+
1595
+ There is a key difference:
1596
+
1597
+ * For better usability, virtual focus is used to highlight the suggestions inside the popover. This means focus remains on the input, but the suggestions are highlighted as if they are in focus, allowing the user to type and navigate the suggestions with the arrow keys.
1598
+ * To denote the highlighted suggestion to screen readers, the `aria-activedescendant` attribute is used.
1599
+
1600
+ Examples
1601
+ --------
1602
+
1603
+ ### `autoSelect`
1604
+
1605
+ The `autoSelect` prop will automatically select the highlighted option when the user blurs the autocomplete. This is set to true by default, but can be switched off.
1606
+
1607
+ [](./iframe.html?id=components-autocomplete--remove-auto-select)
1608
+
1609
+ ```
1610
+
1611
+ <IressAutocomplete
1612
+ autoSelect\={false}
1613
+ options\={\[
1614
+ {
1615
+ label: 'Option 1'
1616
+ },
1617
+ {
1618
+ label: 'Option 2'
1619
+ },
1620
+ {
1621
+ label: 'Option 3'
1622
+ },
1623
+ {
1624
+ label: 'Option 4'
1625
+ },
1626
+ {
1627
+ label: 'Option 5'
1628
+ }
1629
+ \]}
1630
+ placeholder\="Should no longer auto-select when an item is highlighted"
1631
+ popoverProps\={{
1632
+ container: {}
1633
+ }}
1634
+ />
1635
+
1636
+ ```
1637
+
1638
+ #### Props
1639
+
1640
+ | Name | Description | Default | Control |
1641
+ | --- | --- | --- | --- |
1642
+ | alwaysShowOnFocus |
1643
+ Always shown on focus, even if the user has not interacted with the input.
1644
+
1645
+ boolean
1646
+
1647
+
1648
+
1649
+ | \- | Set boolean |
1650
+ | append |
1651
+
1652
+ Append content.
1653
+
1654
+ ReactNode
1655
+
1656
+
1657
+
1658
+ |
1659
+
1660
+ <IressIcon />
1661
+
1662
+
1663
+
1664
+ | Set object |
1665
+ | autoComplete |
1666
+
1667
+ |
1668
+
1669
+ 'off'
1670
+
1671
+ | Set object |
1672
+ | autoSelect |
1673
+
1674
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
1675
+
1676
+ boolean
1677
+
1678
+
1679
+
1680
+ |
1681
+
1682
+ true
1683
+
1684
+ | FalseTrue |
1685
+ | clearable |
1686
+
1687
+ If `true`, then user can clear the value of the input.
1688
+
1689
+ boolean
1690
+
1691
+
1692
+
1693
+ |
1694
+
1695
+ true
1696
+
1697
+ | Set boolean |
1698
+ | errorText |
1699
+
1700
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
1701
+
1702
+ ReactNode
1703
+
1704
+
1705
+
1706
+ |
1707
+
1708
+ <IressAlert />
1709
+
1710
+
1711
+
1712
+ | Set object |
1713
+ | limitDesktop |
1714
+
1715
+ |
1716
+
1717
+ 12
1718
+
1719
+ | Set object |
1720
+ | limitMobile |
1721
+
1722
+ |
1723
+
1724
+ 6
1725
+
1726
+ | Set object |
1727
+ | noResultsText |
1728
+
1729
+ Text to be displayed when no results are found.
1730
+
1731
+ ReactNode
1732
+
1733
+
1734
+
1735
+ | \- | Set object |
1736
+ | onChange |
1737
+
1738
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
1739
+
1740
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
1741
+
1742
+ | \- | \- |
1743
+ | options |
1744
+
1745
+ array
1746
+
1747
+
1748
+
1749
+ | \- |
1750
+
1751
+ RAW
1752
+
1753
+ * options :
1754
+
1755
+ \[
1756
+
1757
+ * 0 :
1758
+
1759
+ {...} 1 key
1760
+
1761
+ * 1 :
1762
+
1763
+ {...} 1 key
1764
+
1765
+ * 2 :
1766
+
1767
+ {...} 1 key
1768
+
1769
+ * 3 :
1770
+
1771
+ {...} 1 key
1772
+
1773
+ * 4 :
1774
+
1775
+ {...} 1 key
1776
+
1777
+
1778
+ \]
1779
+
1780
+
1781
+
1782
+
1783
+ |
1784
+ | placeholder |
1785
+
1786
+ string
1787
+
1788
+
1789
+
1790
+ | \- | Should no longer auto-select when an item is highlighted |
1791
+ | popoverProps |
1792
+
1793
+ Customise the IressInputPopover props for your needs.
1794
+
1795
+ AutocompletePopoverProps
1796
+
1797
+
1798
+
1799
+ | { } |
1800
+
1801
+ RAW
1802
+
1803
+ popoverProps :
1804
+
1805
+ {
1806
+
1807
+ }
1808
+
1809
+
1810
+
1811
+
1812
+
1813
+
1814
+
1815
+ |
1816
+ | watermark |
1817
+
1818
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
1819
+
1820
+ boolean
1821
+
1822
+
1823
+
1824
+ |
1825
+
1826
+ true
1827
+
1828
+ | Set boolean |
1829
+
1830
+ ### Input props
1831
+
1832
+ Autocomplete extends `IressInput`, hence it has the same properties as `IressInput`.
1833
+
1834
+ It does have some defaults to help with user experience. `append` automatically has a search icon, and `clearable` and `watermark` are set to true by default.
1835
+
1836
+ [](./iframe.html?id=components-autocomplete--input-props)
1837
+
1838
+ ```
1839
+
1840
+ <IressAutocomplete
1841
+ append\={<IressPopover activator\={<IressButton mode\="tertiary"\><IressIcon name\="cog" /></IressButton\>} align\="bottom-end" container\={document.body}\><IressPanel className\="iress-u-text"\>Some settings in here</IressPanel\></IressPopover\>}
1842
+ options\={\[
1843
+ {
1844
+ label: 'Option 1'
1845
+ },
1846
+ {
1847
+ label: 'Option 2'
1848
+ },
1849
+ {
1850
+ label: 'Option 3'
1851
+ },
1852
+ {
1853
+ label: 'Option 4'
1854
+ },
1855
+ {
1856
+ label: 'Option 5'
1857
+ }
1858
+ \]}
1859
+ popoverProps\={{
1860
+ container: {}
1861
+ }}
1862
+ prepend\={<IressIcon name\="search" />}
1863
+ width\="12"
1864
+ />
1865
+
1866
+ ```
1867
+
1868
+ #### Props
1869
+
1870
+ | Name | Description | Default | Control |
1871
+ | --- | --- | --- | --- |
1872
+ | alwaysShowOnFocus |
1873
+ Always shown on focus, even if the user has not interacted with the input.
1874
+
1875
+ boolean
1876
+
1877
+
1878
+
1879
+ | \- | Set boolean |
1880
+ | append |
1881
+
1882
+ Append content.
1883
+
1884
+ ReactNode
1885
+
1886
+
1887
+
1888
+ |
1889
+
1890
+ <IressIcon />
1891
+
1892
+
1893
+
1894
+ |
1895
+
1896
+ RAW
1897
+
1898
+ append :
1899
+
1900
+ {
1901
+
1902
+ * $$typeof : Symbol(react.transitional.element)
1903
+ * type :
1904
+
1905
+ {...} 5 keys
1906
+
1907
+ * key : null
1908
+ * props :
1909
+
1910
+ {...} 4 keys
1911
+
1912
+ * \_owner : null
1913
+ * \_store :
1914
+
1915
+ {...} 0 keys
1916
+
1917
+
1918
+ }
1919
+
1920
+
1921
+
1922
+
1923
+
1924
+
1925
+
1926
+ |
1927
+ | autoComplete |
1928
+
1929
+ |
1930
+
1931
+ 'off'
1932
+
1933
+ | Set object |
1934
+ | autoSelect |
1935
+
1936
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
1937
+
1938
+ boolean
1939
+
1940
+
1941
+
1942
+ |
1943
+
1944
+ true
1945
+
1946
+ | Set boolean |
1947
+ | clearable |
1948
+
1949
+ If `true`, then user can clear the value of the input.
1950
+
1951
+ boolean
1952
+
1953
+
1954
+
1955
+ |
1956
+
1957
+ true
1958
+
1959
+ | Set boolean |
1960
+ | errorText |
1961
+
1962
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
1963
+
1964
+ ReactNode
1965
+
1966
+
1967
+
1968
+ |
1969
+
1970
+ <IressAlert />
1971
+
1972
+
1973
+
1974
+ | Set object |
1975
+ | limitDesktop |
1976
+
1977
+ |
1978
+
1979
+ 12
1980
+
1981
+ | Set object |
1982
+ | limitMobile |
1983
+
1984
+ |
1985
+
1986
+ 6
1987
+
1988
+ | Set object |
1989
+ | noResultsText |
1990
+
1991
+ Text to be displayed when no results are found.
1992
+
1993
+ ReactNode
1994
+
1995
+
1996
+
1997
+ | \- | Set object |
1998
+ | onChange |
1999
+
2000
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
2001
+
2002
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
2003
+
2004
+ | \- | \- |
2005
+ | options |
2006
+
2007
+ array
2008
+
2009
+
2010
+
2011
+ | \- |
2012
+
2013
+ RAW
2014
+
2015
+ * options :
2016
+
2017
+ \[
2018
+
2019
+ * 0 :
2020
+
2021
+ {...} 1 key
2022
+
2023
+ * 1 :
2024
+
2025
+ {...} 1 key
2026
+
2027
+ * 2 :
2028
+
2029
+ {...} 1 key
2030
+
2031
+ * 3 :
2032
+
2033
+ {...} 1 key
2034
+
2035
+ * 4 :
2036
+
2037
+ {...} 1 key
2038
+
2039
+
2040
+ \]
2041
+
2042
+
2043
+
2044
+
2045
+ |
2046
+ | popoverProps |
2047
+
2048
+ Customise the IressInputPopover props for your needs.
2049
+
2050
+ AutocompletePopoverProps
2051
+
2052
+
2053
+
2054
+ | { } |
2055
+
2056
+ RAW
2057
+
2058
+ popoverProps :
2059
+
2060
+ {
2061
+
2062
+ }
2063
+
2064
+
2065
+
2066
+
2067
+
2068
+
2069
+
2070
+ |
2071
+ | prepend |
2072
+
2073
+ object
2074
+
2075
+
2076
+
2077
+ | \- |
2078
+
2079
+ RAW
2080
+
2081
+ prepend :
2082
+
2083
+ {
2084
+
2085
+ * $$typeof : Symbol(react.transitional.element)
2086
+ * type :
2087
+
2088
+ {...} 9 keys
2089
+
2090
+ * key : null
2091
+ * props :
2092
+
2093
+ {...} 1 key
2094
+
2095
+ * \_owner : null
2096
+ * \_store :
2097
+
2098
+ {...} 0 keys
2099
+
2100
+
2101
+ }
2102
+
2103
+
2104
+
2105
+
2106
+
2107
+
2108
+
2109
+ |
2110
+ | watermark |
2111
+
2112
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
2113
+
2114
+ boolean
2115
+
2116
+
2117
+
2118
+ |
2119
+
2120
+ true
2121
+
2122
+ | Set boolean |
2123
+ | width |
2124
+
2125
+ string
2126
+
2127
+
2128
+
2129
+ | \- | 12 |
2130
+
2131
+ ### No results
2132
+
2133
+ If you would like to show a message when there are no results, you can use the `noResultsText` prop. It accepts any React node.
2134
+
2135
+ [](./iframe.html?id=components-autocomplete--no-results-text)
2136
+
2137
+ ```
2138
+
2139
+ <IressAutocomplete
2140
+ noResultsText\={<IressPanel className\="iress-u-text"\>No results found</IressPanel\>}
2141
+ options\={\[
2142
+ {
2143
+ label: 'Option 1'
2144
+ },
2145
+ {
2146
+ label: 'Option 2'
2147
+ },
2148
+ {
2149
+ label: 'Option 3'
2150
+ },
2151
+ {
2152
+ label: 'Option 4'
2153
+ },
2154
+ {
2155
+ label: 'Option 5'
2156
+ }
2157
+ \]}
2158
+ placeholder\="Type &quot;no&quot; to see the no results text"
2159
+ popoverProps\={{
2160
+ container: {}
2161
+ }}
2162
+ />
2163
+
2164
+ ```
2165
+
2166
+ #### Props
2167
+
2168
+ | Name | Description | Default | Control |
2169
+ | --- | --- | --- | --- |
2170
+ | alwaysShowOnFocus |
2171
+ Always shown on focus, even if the user has not interacted with the input.
2172
+
2173
+ boolean
2174
+
2175
+
2176
+
2177
+ | \- | Set boolean |
2178
+ | append |
2179
+
2180
+ Append content.
2181
+
2182
+ ReactNode
2183
+
2184
+
2185
+
2186
+ |
2187
+
2188
+ <IressIcon />
2189
+
2190
+
2191
+
2192
+ | Set object |
2193
+ | autoComplete |
2194
+
2195
+ |
2196
+
2197
+ 'off'
2198
+
2199
+ | Set object |
2200
+ | autoSelect |
2201
+
2202
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
2203
+
2204
+ boolean
2205
+
2206
+
2207
+
2208
+ |
2209
+
2210
+ true
2211
+
2212
+ | Set boolean |
2213
+ | clearable |
2214
+
2215
+ If `true`, then user can clear the value of the input.
2216
+
2217
+ boolean
2218
+
2219
+
2220
+
2221
+ |
2222
+
2223
+ true
2224
+
2225
+ | Set boolean |
2226
+ | errorText |
2227
+
2228
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
2229
+
2230
+ ReactNode
2231
+
2232
+
2233
+
2234
+ |
2235
+
2236
+ <IressAlert />
2237
+
2238
+
2239
+
2240
+ | Set object |
2241
+ | limitDesktop |
2242
+
2243
+ |
2244
+
2245
+ 12
2246
+
2247
+ | Set object |
2248
+ | limitMobile |
2249
+
2250
+ |
2251
+
2252
+ 6
2253
+
2254
+ | Set object |
2255
+ | noResultsText |
2256
+
2257
+ Text to be displayed when no results are found.
2258
+
2259
+ ReactNode
2260
+
2261
+
2262
+
2263
+ | \- |
2264
+
2265
+ RAW
2266
+
2267
+ noResultsText :
2268
+
2269
+ {
2270
+
2271
+ * $$typeof : Symbol(react.transitional.element)
2272
+ * type : ({ children, background = "default", noBorderRadius, noGutter, padding = "md", stretch, textAlign = "inherit", className, ...restProps }) => { const classMap = { \[PanelCssClass.Stretch\]: stretch, \[PanelCssClass.NoBorderRadius\]: noBorderRadius, \[PanelCssClass.NoGutter\]: noGutter }; const cssClasses = classNames( className, PanelCssClass.Base, \`${GlobalCSSClass.TextAlignBase}--${textAlign}\`, \`${PanelCssClass.Background}--${background}\`, getResponsivePaddingClasses(padding), classMap ); return /\* @\_\_PURE\_\_ \*/ jsxDEV("div", { className: cssClasses, ...restProps, children }, void 0, false, { fileName: "/home/runner/work/design-system/design-system/packages/components/src/components/Panel/Panel.tsx", lineNumber: 38, columnNumber: 5 }, this); }
2273
+ * key : null
2274
+ * props :
2275
+
2276
+ {...} 2 keys
2277
+
2278
+ * \_owner : null
2279
+ * \_store :
2280
+
2281
+ {...} 0 keys
2282
+
2283
+
2284
+ }
2285
+
2286
+
2287
+
2288
+
2289
+
2290
+
2291
+
2292
+ |
2293
+ | onChange |
2294
+
2295
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
2296
+
2297
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
2298
+
2299
+ | \- | \- |
2300
+ | options |
2301
+
2302
+ array
2303
+
2304
+
2305
+
2306
+ | \- |
2307
+
2308
+ RAW
2309
+
2310
+ * options :
2311
+
2312
+ \[
2313
+
2314
+ * 0 :
2315
+
2316
+ {...} 1 key
2317
+
2318
+ * 1 :
2319
+
2320
+ {...} 1 key
2321
+
2322
+ * 2 :
2323
+
2324
+ {...} 1 key
2325
+
2326
+ * 3 :
2327
+
2328
+ {...} 1 key
2329
+
2330
+ * 4 :
2331
+
2332
+ {...} 1 key
2333
+
2334
+
2335
+ \]
2336
+
2337
+
2338
+
2339
+
2340
+ |
2341
+ | placeholder |
2342
+
2343
+ string
2344
+
2345
+
2346
+
2347
+ | \- | Type "no" to see the no results text |
2348
+ | popoverProps |
2349
+
2350
+ Customise the IressInputPopover props for your needs.
2351
+
2352
+ AutocompletePopoverProps
2353
+
2354
+
2355
+
2356
+ | { } |
2357
+
2358
+ RAW
2359
+
2360
+ popoverProps :
2361
+
2362
+ {
2363
+
2364
+ }
2365
+
2366
+
2367
+
2368
+
2369
+
2370
+
2371
+
2372
+ |
2373
+ | watermark |
2374
+
2375
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
2376
+
2377
+ boolean
2378
+
2379
+
2380
+
2381
+ |
2382
+
2383
+ true
2384
+
2385
+ | Set boolean |
2386
+
2387
+ ### Popover props
2388
+
2389
+ Under the hood, autocomplete uses `IressInputPopover` to display the suggestions. It accepts `autoHighlight`, `align`, `className` and `displayMode`.
2390
+
2391
+ There are two additional props that autocomplete accepts to customise the popover: `append` and `prepend`. You can place additional content above or below the results using these props.
2392
+
2393
+ [](./iframe.html?id=components-autocomplete--popover-props)
2394
+
2395
+ ```
2396
+
2397
+ <IressAutocomplete
2398
+ options\={\[
2399
+ {
2400
+ label: 'Option 1'
2401
+ },
2402
+ {
2403
+ label: 'Option 2'
2404
+ },
2405
+ {
2406
+ label: 'Option 3'
2407
+ },
2408
+ {
2409
+ label: 'Option 4'
2410
+ },
2411
+ {
2412
+ label: 'Option 5'
2413
+ }
2414
+ \]}
2415
+ popoverProps\={{
2416
+ append: <IressPanel\><IressButton\>Add an option</IressButton\></IressPanel\>,
2417
+ container: {}
2418
+ }}
2419
+ />
2420
+
2421
+ ```
2422
+
2423
+ #### Props
2424
+
2425
+ | Name | Description | Default | Control |
2426
+ | --- | --- | --- | --- |
2427
+ | alwaysShowOnFocus |
2428
+ Always shown on focus, even if the user has not interacted with the input.
2429
+
2430
+ boolean
2431
+
2432
+
2433
+
2434
+ | \- | Set boolean |
2435
+ | append |
2436
+
2437
+ Append content.
2438
+
2439
+ ReactNode
2440
+
2441
+
2442
+
2443
+ |
2444
+
2445
+ <IressIcon />
2446
+
2447
+
2448
+
2449
+ | Set object |
2450
+ | autoComplete |
2451
+
2452
+ |
2453
+
2454
+ 'off'
2455
+
2456
+ | Set object |
2457
+ | autoSelect |
2458
+
2459
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
2460
+
2461
+ boolean
2462
+
2463
+
2464
+
2465
+ |
2466
+
2467
+ true
2468
+
2469
+ | Set boolean |
2470
+ | clearable |
2471
+
2472
+ If `true`, then user can clear the value of the input.
2473
+
2474
+ boolean
2475
+
2476
+
2477
+
2478
+ |
2479
+
2480
+ true
2481
+
2482
+ | Set boolean |
2483
+ | errorText |
2484
+
2485
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
2486
+
2487
+ ReactNode
2488
+
2489
+
2490
+
2491
+ |
2492
+
2493
+ <IressAlert />
2494
+
2495
+
2496
+
2497
+ | Set object |
2498
+ | limitDesktop |
2499
+
2500
+ |
2501
+
2502
+ 12
2503
+
2504
+ | Set object |
2505
+ | limitMobile |
2506
+
2507
+ |
2508
+
2509
+ 6
2510
+
2511
+ | Set object |
2512
+ | noResultsText |
2513
+
2514
+ Text to be displayed when no results are found.
2515
+
2516
+ ReactNode
2517
+
2518
+
2519
+
2520
+ | \- | Set object |
2521
+ | onChange |
2522
+
2523
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
2524
+
2525
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
2526
+
2527
+ | \- | \- |
2528
+ | options |
2529
+
2530
+ array
2531
+
2532
+
2533
+
2534
+ | \- |
2535
+
2536
+ RAW
2537
+
2538
+ * options :
2539
+
2540
+ \[
2541
+
2542
+ * 0 :
2543
+
2544
+ {...} 1 key
2545
+
2546
+ * 1 :
2547
+
2548
+ {...} 1 key
2549
+
2550
+ * 2 :
2551
+
2552
+ {...} 1 key
2553
+
2554
+ * 3 :
2555
+
2556
+ {...} 1 key
2557
+
2558
+ * 4 :
2559
+
2560
+ {...} 1 key
2561
+
2562
+
2563
+ \]
2564
+
2565
+
2566
+
2567
+
2568
+ |
2569
+ | popoverProps |
2570
+
2571
+ Customise the IressInputPopover props for your needs.
2572
+
2573
+ AutocompletePopoverProps
2574
+
2575
+
2576
+
2577
+ | { } |
2578
+
2579
+ RAW
2580
+
2581
+ popoverProps :
2582
+
2583
+ {
2584
+
2585
+ * append :
2586
+
2587
+ {...} 6 keys
2588
+
2589
+
2590
+ }
2591
+
2592
+
2593
+
2594
+
2595
+
2596
+
2597
+
2598
+ |
2599
+ | watermark |
2600
+
2601
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
2602
+
2603
+ boolean
2604
+
2605
+
2606
+
2607
+ |
2608
+
2609
+ true
2610
+
2611
+ | Set boolean |
2612
+
2613
+ ### Debounce threshold
2614
+
2615
+ The `debounceThreshold` prop can be used to set the time in milliseconds to wait before making a request to the `options` function. This is useful when you want to prevent making too many requests to the server.
2616
+
2617
+ By default there is a debounce, but it can be removed by setting it to `0`.
2618
+
2619
+ [](./iframe.html?id=components-autocomplete--debounce-threshold)
2620
+
2621
+ ```
2622
+
2623
+ <IressAutocomplete
2624
+ debounceThreshold\={0}
2625
+ options\={\[
2626
+ {
2627
+ label: 'Option 1'
2628
+ },
2629
+ {
2630
+ label: 'Option 2'
2631
+ },
2632
+ {
2633
+ label: 'Option 3'
2634
+ },
2635
+ {
2636
+ label: 'Option 4'
2637
+ },
2638
+ {
2639
+ label: 'Option 5'
2640
+ }
2641
+ \]}
2642
+ placeholder\="Instant search!"
2643
+ popoverProps\={{
2644
+ container: {}
2645
+ }}
2646
+ />
2647
+
2648
+ ```
2649
+
2650
+ #### Props
2651
+
2652
+ | Name | Description | Default | Control |
2653
+ | --- | --- | --- | --- |
2654
+ | alwaysShowOnFocus |
2655
+ Always shown on focus, even if the user has not interacted with the input.
2656
+
2657
+ boolean
2658
+
2659
+
2660
+
2661
+ | \- | Set boolean |
2662
+ | append |
2663
+
2664
+ Append content.
2665
+
2666
+ ReactNode
2667
+
2668
+
2669
+
2670
+ |
2671
+
2672
+ <IressIcon />
2673
+
2674
+
2675
+
2676
+ | Set object |
2677
+ | autoComplete |
2678
+
2679
+ |
2680
+
2681
+ 'off'
2682
+
2683
+ | Set object |
2684
+ | autoSelect |
2685
+
2686
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
2687
+
2688
+ boolean
2689
+
2690
+
2691
+
2692
+ |
2693
+
2694
+ true
2695
+
2696
+ | Set boolean |
2697
+ | clearable |
2698
+
2699
+ If `true`, then user can clear the value of the input.
2700
+
2701
+ boolean
2702
+
2703
+
2704
+
2705
+ |
2706
+
2707
+ true
2708
+
2709
+ | Set boolean |
2710
+ | debounceThreshold |
2711
+
2712
+ number
2713
+
2714
+
2715
+
2716
+ | \- | |
2717
+ | errorText |
2718
+
2719
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
2720
+
2721
+ ReactNode
2722
+
2723
+
2724
+
2725
+ |
2726
+
2727
+ <IressAlert />
2728
+
2729
+
2730
+
2731
+ | Set object |
2732
+ | limitDesktop |
2733
+
2734
+ |
2735
+
2736
+ 12
2737
+
2738
+ | Set object |
2739
+ | limitMobile |
2740
+
2741
+ |
2742
+
2743
+ 6
2744
+
2745
+ | Set object |
2746
+ | noResultsText |
2747
+
2748
+ Text to be displayed when no results are found.
2749
+
2750
+ ReactNode
2751
+
2752
+
2753
+
2754
+ | \- | Set object |
2755
+ | onChange |
2756
+
2757
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
2758
+
2759
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
2760
+
2761
+ | \- | \- |
2762
+ | options |
2763
+
2764
+ array
2765
+
2766
+
2767
+
2768
+ | \- |
2769
+
2770
+ RAW
2771
+
2772
+ * options :
2773
+
2774
+ \[
2775
+
2776
+ * 0 :
2777
+
2778
+ {...} 1 key
2779
+
2780
+ * 1 :
2781
+
2782
+ {...} 1 key
2783
+
2784
+ * 2 :
2785
+
2786
+ {...} 1 key
2787
+
2788
+ * 3 :
2789
+
2790
+ {...} 1 key
2791
+
2792
+ * 4 :
2793
+
2794
+ {...} 1 key
2795
+
2796
+
2797
+ \]
2798
+
2799
+
2800
+
2801
+
2802
+ |
2803
+ | placeholder |
2804
+
2805
+ string
2806
+
2807
+
2808
+
2809
+ | \- | Instant search! |
2810
+ | popoverProps |
2811
+
2812
+ Customise the IressInputPopover props for your needs.
2813
+
2814
+ AutocompletePopoverProps
2815
+
2816
+
2817
+
2818
+ | { } |
2819
+
2820
+ RAW
2821
+
2822
+ popoverProps :
2823
+
2824
+ {
2825
+
2826
+ }
2827
+
2828
+
2829
+
2830
+
2831
+
2832
+
2833
+
2834
+ |
2835
+ | watermark |
2836
+
2837
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
2838
+
2839
+ boolean
2840
+
2841
+
2842
+
2843
+ |
2844
+
2845
+ true
2846
+
2847
+ | Set boolean |
2848
+
2849
+ ### Result limits
2850
+
2851
+ You can limit the maximum amount of search results displayed in the suggestions by setting the `limitDesktop` prop. This defaults to 12.
2852
+
2853
+ On smaller screens (< 768px), the number of options is further reduced by using the `limitMobile` prop, which defaults to 6.
2854
+
2855
+ `limitMobile` works by filtering the search results that have been filtered by `limitDesktop`, so must be a smaller value. For example:
2856
+
2857
+ // 12 results on large screens, 6 on small screens (default values)
2858
+ <IressAutocomplete options\={...} />
2859
+ // 4 results on large screens, 3 on small screens
2860
+ <IressAutocomplete resultLimitDesktop\={4} resultLimitMobile\={3} options\={...} />
2861
+ // 4 results on all screens (resultLimitMobile > resultLimitDesktop so has no effect)
2862
+ <IressAutocomplete resultLimitDesktop\={4} resultLimitMobile\={5} options\={...} />
2863
+
2864
+ ```
2865
+
2866
+ The result limits will also affect the number of initial options displayed, if the `initialOptions` prop is set.
2867
+
2868
+ [](./iframe.html?id=components-autocomplete--result-limits)
2869
+
2870
+ **xl** breakpoint (1200px - 1499px)
2871
+
2872
+ ```
2873
+
2874
+ <IressStack gutter\="md"\>
2875
+ <IressPanel className\="iress-u-text"\>
2876
+ <kn />
2877
+ </IressPanel\>
2878
+ <IressAutocomplete
2879
+ limitDesktop\={6}
2880
+ limitMobile\={3}
2881
+ options\={\[
2882
+ {
2883
+ label: 'Option 1'
2884
+ },
2885
+ {
2886
+ label: 'Option 2'
2887
+ },
2888
+ {
2889
+ label: 'Option 3'
2890
+ },
2891
+ {
2892
+ label: 'Option 4'
2893
+ },
2894
+ {
2895
+ label: 'Option 5'
2896
+ },
2897
+ {
2898
+ label: 'Option 6'
2899
+ },
2900
+ {
2901
+ label: 'Option 7'
2902
+ },
2903
+ {
2904
+ label: 'Option 8'
2905
+ },
2906
+ {
2907
+ label: 'Option 9'
2908
+ },
2909
+ {
2910
+ label: 'Option 10'
2911
+ },
2912
+ {
2913
+ label: 'Option 11'
2914
+ },
2915
+ {
2916
+ label: 'Option 12'
2917
+ },
2918
+ {
2919
+ label: 'Option 13'
2920
+ },
2921
+ {
2922
+ label: 'Option 14'
2923
+ },
2924
+ {
2925
+ label: 'Option 15'
2926
+ }
2927
+ \]}
2928
+ popoverProps\={{
2929
+ container: {}
2930
+ }}
2931
+ />
2932
+ </IressStack\>
2933
+
2934
+ ```
2935
+
2936
+ #### Props
2937
+
2938
+ | Name | Description | Default | Control |
2939
+ | --- | --- | --- | --- |
2940
+ | alwaysShowOnFocus |
2941
+ Always shown on focus, even if the user has not interacted with the input.
2942
+
2943
+ boolean
2944
+
2945
+
2946
+
2947
+ | \- | Set boolean |
2948
+ | append |
2949
+
2950
+ Append content.
2951
+
2952
+ ReactNode
2953
+
2954
+
2955
+
2956
+ |
2957
+
2958
+ <IressIcon />
2959
+
2960
+
2961
+
2962
+ | Set object |
2963
+ | autoComplete |
2964
+
2965
+ |
2966
+
2967
+ 'off'
2968
+
2969
+ | Set object |
2970
+ | autoSelect |
2971
+
2972
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
2973
+
2974
+ boolean
2975
+
2976
+
2977
+
2978
+ |
2979
+
2980
+ true
2981
+
2982
+ | Set boolean |
2983
+ | clearable |
2984
+
2985
+ If `true`, then user can clear the value of the input.
2986
+
2987
+ boolean
2988
+
2989
+
2990
+
2991
+ |
2992
+
2993
+ true
2994
+
2995
+ | Set boolean |
2996
+ | errorText |
2997
+
2998
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
2999
+
3000
+ ReactNode
3001
+
3002
+
3003
+
3004
+ |
3005
+
3006
+ <IressAlert />
3007
+
3008
+
3009
+
3010
+ | Set object |
3011
+ | limitDesktop |
3012
+
3013
+ number
3014
+
3015
+
3016
+
3017
+ |
3018
+
3019
+ 12
3020
+
3021
+ | |
3022
+ | limitMobile |
3023
+
3024
+ number
3025
+
3026
+
3027
+
3028
+ |
3029
+
3030
+ 6
3031
+
3032
+ | |
3033
+ | noResultsText |
3034
+
3035
+ Text to be displayed when no results are found.
3036
+
3037
+ ReactNode
3038
+
3039
+
3040
+
3041
+ | \- | Set object |
3042
+ | onChange |
3043
+
3044
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
3045
+
3046
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
3047
+
3048
+ | \- | \- |
3049
+ | options |
3050
+
3051
+ array
3052
+
3053
+
3054
+
3055
+ | \- |
3056
+
3057
+ RAW
3058
+
3059
+ * options :
3060
+
3061
+ \[
3062
+
3063
+ * 0 :
3064
+
3065
+ {...} 1 key
3066
+
3067
+ * 1 :
3068
+
3069
+ {...} 1 key
3070
+
3071
+ * 2 :
3072
+
3073
+ {...} 1 key
3074
+
3075
+ * 3 :
3076
+
3077
+ {...} 1 key
3078
+
3079
+ * 4 :
3080
+
3081
+ {...} 1 key
3082
+
3083
+ * 5 :
3084
+
3085
+ {...} 1 key
3086
+
3087
+ * 6 :
3088
+
3089
+ {...} 1 key
3090
+
3091
+ * 7 :
3092
+
3093
+ {...} 1 key
3094
+
3095
+ * 8 :
3096
+
3097
+ {...} 1 key
3098
+
3099
+ * 9 :
3100
+
3101
+ {...} 1 key
3102
+
3103
+ * 10 :
3104
+
3105
+ {...} 1 key
3106
+
3107
+ * 11 :
3108
+
3109
+ {...} 1 key
3110
+
3111
+ * 12 :
3112
+
3113
+ {...} 1 key
3114
+
3115
+ * 13 :
3116
+
3117
+ {...} 1 key
3118
+
3119
+ * 14 :
3120
+
3121
+ {...} 1 key
3122
+
3123
+
3124
+ \]
3125
+
3126
+
3127
+
3128
+
3129
+ |
3130
+ | popoverProps |
3131
+
3132
+ Customise the IressInputPopover props for your needs.
3133
+
3134
+ AutocompletePopoverProps
3135
+
3136
+
3137
+
3138
+ | { } |
3139
+
3140
+ RAW
3141
+
3142
+ popoverProps :
3143
+
3144
+ {
3145
+
3146
+ }
3147
+
3148
+
3149
+
3150
+
3151
+
3152
+
3153
+
3154
+ |
3155
+ | watermark |
3156
+
3157
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
3158
+
3159
+ boolean
3160
+
3161
+
3162
+
3163
+ |
3164
+
3165
+ true
3166
+
3167
+ | Set boolean |
3168
+
3169
+ ### Readonly
3170
+
3171
+ The `readonly` prop can be set to `true` to prevent the user from changing the value of the autocomplete. This will change the input to a custom read-only style and the user will not be able to interact with the input.
3172
+
3173
+ If you need more control over the read-only state (for example, rendering a stylised version of the value), you can use the [`IressReadonly` component](?path=/docs/components-readonly--docs).
3174
+
3175
+ [](./iframe.html?id=components-autocomplete--readonly)
3176
+
3177
+ Option 1
3178
+
3179
+ ```
3180
+
3181
+ <IressAutocomplete
3182
+ defaultValue\="Option 1"
3183
+ options\={\[
3184
+ {
3185
+ label: 'Option 1'
3186
+ },
3187
+ {
3188
+ label: 'Option 2'
3189
+ },
3190
+ {
3191
+ label: 'Option 3'
3192
+ },
3193
+ {
3194
+ label: 'Option 4'
3195
+ },
3196
+ {
3197
+ label: 'Option 5'
3198
+ }
3199
+ \]}
3200
+ popoverProps\={{
3201
+ container: {}
3202
+ }}
3203
+ readOnly
3204
+ />
3205
+
3206
+ ```
3207
+
3208
+ #### Props
3209
+
3210
+ | Name | Description | Default | Control |
3211
+ | --- | --- | --- | --- |
3212
+ | alwaysShowOnFocus |
3213
+ Always shown on focus, even if the user has not interacted with the input.
3214
+
3215
+ boolean
3216
+
3217
+
3218
+
3219
+ | \- | Set boolean |
3220
+ | append |
3221
+
3222
+ Append content.
3223
+
3224
+ ReactNode
3225
+
3226
+
3227
+
3228
+ |
3229
+
3230
+ <IressIcon />
3231
+
3232
+
3233
+
3234
+ | Set object |
3235
+ | autoComplete |
3236
+
3237
+ |
3238
+
3239
+ 'off'
3240
+
3241
+ | Set object |
3242
+ | autoSelect |
3243
+
3244
+ If true, the selected option becomes the value of the input when the autocomplete loses focus.
3245
+
3246
+ boolean
3247
+
3248
+
3249
+
3250
+ |
3251
+
3252
+ true
3253
+
3254
+ | Set boolean |
3255
+ | clearable |
3256
+
3257
+ If `true`, then user can clear the value of the input.
3258
+
3259
+ boolean
3260
+
3261
+
3262
+
3263
+ |
3264
+
3265
+ true
3266
+
3267
+ | Set boolean |
3268
+ | defaultValue |
3269
+
3270
+ string
3271
+
3272
+
3273
+
3274
+ | \- | Option 1 |
3275
+ | errorText |
3276
+
3277
+ Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
3278
+
3279
+ ReactNode
3280
+
3281
+
3282
+
3283
+ |
3284
+
3285
+ <IressAlert />
3286
+
3287
+
3288
+
3289
+ | Set object |
3290
+ | limitDesktop |
3291
+
3292
+ |
3293
+
3294
+ 12
3295
+
3296
+ | Set object |
3297
+ | limitMobile |
3298
+
3299
+ |
3300
+
3301
+ 6
3302
+
3303
+ | Set object |
3304
+ | noResultsText |
3305
+
3306
+ Text to be displayed when no results are found.
3307
+
3308
+ ReactNode
3309
+
3310
+
3311
+
3312
+ | \- | Set object |
3313
+ | onChange |
3314
+
3315
+ Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
3316
+
3317
+ ( e?: SyntheticEvent<InputBaseElement>, value?: T, option?: LabelValueMeta, ) => void
3318
+
3319
+ | \- | \- |
3320
+ | options |
3321
+
3322
+ array
3323
+
3324
+
3325
+
3326
+ | \- |
3327
+
3328
+ RAW
3329
+
3330
+ * options :
3331
+
3332
+ \[
3333
+
3334
+ * 0 :
3335
+
3336
+ {...} 1 key
3337
+
3338
+ * 1 :
3339
+
3340
+ {...} 1 key
3341
+
3342
+ * 2 :
3343
+
3344
+ {...} 1 key
3345
+
3346
+ * 3 :
3347
+
3348
+ {...} 1 key
3349
+
3350
+ * 4 :
3351
+
3352
+ {...} 1 key
3353
+
3354
+
3355
+ \]
3356
+
3357
+
3358
+
3359
+
3360
+ |
3361
+ | popoverProps |
3362
+
3363
+ Customise the IressInputPopover props for your needs.
3364
+
3365
+ AutocompletePopoverProps
3366
+
3367
+
3368
+
3369
+ | { } |
3370
+
3371
+ RAW
3372
+
3373
+ popoverProps :
3374
+
3375
+ {
3376
+
3377
+ }
3378
+
3379
+
3380
+
3381
+
3382
+
3383
+
3384
+
3385
+ |
3386
+ | readOnly |
3387
+
3388
+ boolean
3389
+
3390
+
3391
+
3392
+ | \- | FalseTrue |
3393
+ | watermark |
3394
+
3395
+ When set to `true` add ons will render with a different style. Will be ignored if `prepend` or `append` slots are not being used.
3396
+
3397
+ boolean
3398
+
3399
+
3400
+
3401
+ |
3402
+
3403
+ true
3404
+
3405
+ | Set boolean |
3406
+
3407
+ Testing
3408
+ -------
3409
+
3410
+ To help you effectively test the autocomplete component, we have provided a few tips based on the behaviour of the component and our own experience.
3411
+
3412
+ **Note:** These are suggestions and not requirements. You should test the component in a way that best suits your use case.
3413
+
3414
+ ### Partial query matching
3415
+
3416
+ The suggestions are filtered based on the input value. If the input value only matches a part of the option, the input value is highlighted by a `<b />` tag in each option. You will need to account for this in your tests, either using an exact string match with a space to denote the highlighted value, or using a regex to match the string.
3417
+
3418
+ If you are using `meta`, `prepend` or `append` props in `LabelValueMeta`, you should also consider this in your search query for the option.
3419
+
3420
+ render(
3421
+ <IressAutocomplete
3422
+ options\={\[
3423
+ { label: 'Luke Skywalker', value: 'Luke Skywalker', meta: 'male' },
3424
+ \]}
3425
+ />,
3426
+ );
3427
+ const autocomplete \= screen.getByRole('combobox');
3428
+ await user.type(autocomplete, 'lu');
3429
+ // Exact string match with a space to denote the highlighted value
3430
+ const option \= await screen.findByRole('option', {
3431
+ name: 'Lu ke Skywalker male',
3432
+ });
3433
+ expect(option).toBeInTheDocument();
3434
+ // Using a regex to match the string
3435
+ const option \= await screen.findByRole('option', { name: /Skywalker/ });
3436
+ expect(option).toBeInTheDocument();
3437
+
3438
+ ```
3439
+
3440
+ ### Query for minimal characters
3441
+
3442
+ If you are testing if a specific option appears in the autocomplete that returns asynchronous `options`, it is recommended to use the shortest possible query to return the desired result. The longer the query, the longer it will take to see the results.
3443
+
3444
+ render(<IressAutocomplete options\={searchStarWarsCharacters} />);
3445
+ const autocomplete \= screen.getByRole('combobox');
3446
+ // DO: Use the shortest query to return the desired result
3447
+ await user.type(autocomplete, 'lu');
3448
+ const option \= await screen.findAllByRole('option');
3449
+ // DON'T: Use a long query to return the desired result
3450
+ await user.type(autocomplete, 'luke skywalker');
3451
+ const option \= await screen.findAllByRole('option');
3452
+
3453
+ ```
3454
+
3455
+ ### Use mocking when testing APIs
3456
+
3457
+ When testing the autocomplete component with asynchronous `options`, you should mock the API call to return a known set of results, rather than rely on a public prototyping API (eg. [https://swapi.py4e.com/](https://swapi.py4e.com/)). This will allow you to test the component in isolation without relying on the API to return the expected results, as well as reduce chance of flakiness due to timeouts in your tests.
3458
+
3459
+ We recommend using [Mock Service Worker](https://mswjs.io/) to mock the API calls in your tests.
3460
+
3461
+ // src/mocks/handlers.ts
3462
+ import { http, HttpResponse } from 'msw';
3463
+ export const handlers \= \[
3464
+ // Intercept "GET https://swapi.py4e.com/api/people" requests...
3465
+ http.get('https://swapi.py4e.com/api/people', () \=> {
3466
+ // ...and respond to them using this JSON response.
3467
+ return HttpResponse.json(\[
3468
+ { name: 'Luke Skywalker', gender: 'male' },
3469
+ { name: 'Leia Skywalker', gender: 'female' },
3470
+ \]);
3471
+ }),
3472
+ \];
3473
+ // src/mocks/node.js
3474
+ import { setupServer } from 'msw/node';
3475
+ import { handlers } from './handlers';
3476
+ export const server \= setupServer(...handlers);
3477
+ // src/CustomAutocomplete.test.tsx
3478
+ import { server } from './mocks/node';
3479
+ server.listen();
3480
+ render(<IressAutocomplete options\={searchStarWarsCharacters} />);
3481
+ const autocomplete \= screen.getByRole('combobox');
3482
+ await user.type(autocomplete, 'lu');
3483
+ const option \= await screen.findAllByRole('option');
3484
+
3485
+ ```