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

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