@iress-oss/ids-mcp-server 6.0.0-alpha.0 → 6.0.0-alpha.1-canary-20251204014525-3f0dce4

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 (108) hide show
  1. package/dist/searchHandlers.test.js +8 -2
  2. package/dist/toolHandler.test.js +9 -9
  3. package/dist/utils.test.js +6 -2
  4. package/package.json +32 -30
  5. package/generated/docs/components-alert-docs.md +0 -702
  6. package/generated/docs/components-autocomplete-docs.md +0 -1433
  7. package/generated/docs/components-autocomplete-recipes-docs.md +0 -104
  8. package/generated/docs/components-badge-docs.md +0 -531
  9. package/generated/docs/components-button-docs.md +0 -1442
  10. package/generated/docs/components-buttongroup-docs.md +0 -748
  11. package/generated/docs/components-card-docs.md +0 -944
  12. package/generated/docs/components-checkbox-docs.md +0 -694
  13. package/generated/docs/components-checkboxgroup-docs.md +0 -1087
  14. package/generated/docs/components-checkboxgroup-recipes-docs.md +0 -119
  15. package/generated/docs/components-col-docs.md +0 -881
  16. package/generated/docs/components-container-docs.md +0 -123
  17. package/generated/docs/components-divider-docs.md +0 -576
  18. package/generated/docs/components-expander-docs.md +0 -594
  19. package/generated/docs/components-field-docs.md +0 -2007
  20. package/generated/docs/components-filter-docs.md +0 -1322
  21. package/generated/docs/components-hide-docs.md +0 -702
  22. package/generated/docs/components-icon-docs.md +0 -816
  23. package/generated/docs/components-image-docs.md +0 -493
  24. package/generated/docs/components-inline-docs.md +0 -2003
  25. package/generated/docs/components-input-docs.md +0 -867
  26. package/generated/docs/components-input-recipes-docs.md +0 -140
  27. package/generated/docs/components-inputcurrency-docs.md +0 -689
  28. package/generated/docs/components-inputcurrency-recipes-docs.md +0 -115
  29. package/generated/docs/components-introduction-docs.md +0 -450
  30. package/generated/docs/components-label-docs.md +0 -562
  31. package/generated/docs/components-link-docs.md +0 -586
  32. package/generated/docs/components-menu-docs.md +0 -1146
  33. package/generated/docs/components-menu-menuitem-docs.md +0 -739
  34. package/generated/docs/components-modal-docs.md +0 -1346
  35. package/generated/docs/components-panel-docs.md +0 -600
  36. package/generated/docs/components-placeholder-docs.md +0 -446
  37. package/generated/docs/components-popover-docs.md +0 -1529
  38. package/generated/docs/components-popover-recipes-docs.md +0 -211
  39. package/generated/docs/components-progress-docs.md +0 -568
  40. package/generated/docs/components-provider-docs.md +0 -160
  41. package/generated/docs/components-radio-docs.md +0 -563
  42. package/generated/docs/components-radiogroup-docs.md +0 -1153
  43. package/generated/docs/components-readonly-docs.md +0 -535
  44. package/generated/docs/components-richselect-docs.md +0 -5836
  45. package/generated/docs/components-row-docs.md +0 -2354
  46. package/generated/docs/components-select-docs.md +0 -940
  47. package/generated/docs/components-skeleton-docs.md +0 -597
  48. package/generated/docs/components-skeleton-recipes-docs.md +0 -76
  49. package/generated/docs/components-skiplink-docs.md +0 -587
  50. package/generated/docs/components-slideout-docs.md +0 -1036
  51. package/generated/docs/components-slider-docs.md +0 -828
  52. package/generated/docs/components-spinner-docs.md +0 -450
  53. package/generated/docs/components-stack-docs.md +0 -923
  54. package/generated/docs/components-table-ag-grid-docs.md +0 -1444
  55. package/generated/docs/components-table-docs.md +0 -2327
  56. package/generated/docs/components-tabset-docs.md +0 -768
  57. package/generated/docs/components-tabset-tab-docs.md +0 -550
  58. package/generated/docs/components-tag-docs.md +0 -548
  59. package/generated/docs/components-text-docs.md +0 -585
  60. package/generated/docs/components-toaster-docs.md +0 -755
  61. package/generated/docs/components-toggle-docs.md +0 -614
  62. package/generated/docs/components-tooltip-docs.md +0 -747
  63. package/generated/docs/components-validationmessage-docs.md +0 -1161
  64. package/generated/docs/contact-us-docs.md +0 -27
  65. package/generated/docs/extensions-editor-docs.md +0 -1181
  66. package/generated/docs/extensions-editor-recipes-docs.md +0 -89
  67. package/generated/docs/foundations-accessibility-docs.md +0 -40
  68. package/generated/docs/foundations-consistency-docs.md +0 -52
  69. package/generated/docs/foundations-content-docs.md +0 -23
  70. package/generated/docs/foundations-grid-docs.md +0 -74
  71. package/generated/docs/foundations-introduction-docs.md +0 -19
  72. package/generated/docs/foundations-principles-docs.md +0 -70
  73. package/generated/docs/foundations-responsive-breakpoints-docs.md +0 -193
  74. package/generated/docs/foundations-tokens-colour-docs.md +0 -564
  75. package/generated/docs/foundations-tokens-elevation-docs.md +0 -155
  76. package/generated/docs/foundations-tokens-introduction-docs.md +0 -190
  77. package/generated/docs/foundations-tokens-radius-docs.md +0 -71
  78. package/generated/docs/foundations-tokens-spacing-docs.md +0 -89
  79. package/generated/docs/foundations-tokens-typography-docs.md +0 -322
  80. package/generated/docs/foundations-user-experience-docs.md +0 -63
  81. package/generated/docs/foundations-visual-design-docs.md +0 -46
  82. package/generated/docs/foundations-z-index-stacking-docs.md +0 -31
  83. package/generated/docs/frequently-asked-questions-docs.md +0 -53
  84. package/generated/docs/get-started-develop-docs.md +0 -209
  85. package/generated/docs/get-started-using-storybook-docs.md +0 -68
  86. package/generated/docs/guidelines.md +0 -2054
  87. package/generated/docs/introduction-docs.md +0 -87
  88. package/generated/docs/news-version-6-docs.md +0 -93
  89. package/generated/docs/patterns-form-docs.md +0 -3902
  90. package/generated/docs/patterns-form-recipes-docs.md +0 -1370
  91. package/generated/docs/patterns-introduction-docs.md +0 -24
  92. package/generated/docs/patterns-loading-docs.md +0 -4043
  93. package/generated/docs/resources-code-katas-docs.md +0 -29
  94. package/generated/docs/resources-introduction-docs.md +0 -38
  95. package/generated/docs/resources-mcp-server-docs.md +0 -27
  96. package/generated/docs/resources-migration-guides-from-v4-to-v5-docs.md +0 -437
  97. package/generated/docs/styling-props-colour-docs.md +0 -172
  98. package/generated/docs/styling-props-elevation-docs.md +0 -88
  99. package/generated/docs/styling-props-radius-docs.md +0 -86
  100. package/generated/docs/styling-props-reference-docs.md +0 -160
  101. package/generated/docs/styling-props-screen-readers-docs.md +0 -71
  102. package/generated/docs/styling-props-sizing-docs.md +0 -627
  103. package/generated/docs/styling-props-spacing-docs.md +0 -2282
  104. package/generated/docs/styling-props-typography-docs.md +0 -121
  105. package/generated/docs/themes-available-themes-docs.md +0 -66
  106. package/generated/docs/themes-introduction-docs.md +0 -121
  107. package/generated/docs/versions-docs.md +0 -17
  108. /package/{LICENSE.txt → LICENSE} +0 -0
@@ -1,1433 +0,0 @@
1
- [](#autocomplete)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
- Hide code
10
-
11
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
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: document.body
33
- }}
34
- />
35
-
36
- Copy
37
-
38
- [](#props)Props
39
- ---------------
40
-
41
- | Name | Description | Default | Control |
42
- | --- | --- | --- | --- |
43
- | alignRight |
44
- Set input content align to right, useful for numeric inputs.
45
-
46
- booleanundefined
47
-
48
-
49
-
50
- |
51
-
52
- false
53
-
54
- | Set object |
55
- | alwaysShowOnFocus |
56
-
57
- Always shown on focus, even if the user has not interacted with the input.
58
-
59
- booleanundefined
60
-
61
-
62
-
63
- | \- | Set object |
64
- | append |
65
-
66
- Append content.
67
-
68
- ReactNode
69
-
70
-
71
-
72
- |
73
-
74
- <IressIcon />
75
-
76
-
77
-
78
- | Set object |
79
- | autoSelect |
80
-
81
- If true, the selected option becomes the value of the input when the autocomplete loses focus.
82
-
83
- booleanundefined
84
-
85
-
86
-
87
- |
88
-
89
- true
90
-
91
- | Set object |
92
- | bg |
93
-
94
- **`bg`** sets the background color of an element using the `background-color` css property using the color tokens in the design system.
95
-
96
- We recommend using the following token values for best background contrast:
97
-
98
- * `colour.primary.fill` for primary backgrounds that need to stand out
99
- * `colour.primary.surface` for primary backgrounds that need to be less prominent
100
- * `colour.neutral.10` for the base background color, normally white in light mode or shade of grey in dark mode
101
- * `colour.neutral.20` for a slightly darker background color, used in neutral state components
102
- * `colour.system.danger.fill` for error backgrounds that need to stand out
103
- * `colour.system.danger.surface` for error backgrounds that need to be less prominent
104
- * `colour.system.success.fill` for success backgrounds that need to stand out
105
- * `colour.system.success.surface` for success backgrounds that need to be less prominent
106
- * `colour.system.warning.fill` for warning backgrounds that need to stand out
107
- * `colour.system.warning.surface` for warning backgrounds that need to be less prominent
108
- * `colour.system.info.fill` for info backgrounds that need to stand out
109
- * `colour.system.info.surface` for info backgrounds that need to be less prominent
110
-
111
- ResponsiveProp<ColorToken> | undefined
112
-
113
- | \- | Set object |
114
- | borderRadius |
115
-
116
- The **`border-radius`** CSS property rounds the corners of an element's outer border edge using the radius tokens in the design system.
117
-
118
- | Chrome | Firefox | Safari | Edge | IE |
119
- | --- | --- | --- | --- | --- |
120
- | **4** | **4** | **5** | **12** | **9** |
121
- | 1 _\-x-_ | | 3 _\-x-_ | | |
122
-
123
- ResponsiveProp<RadiusToken> | undefined
124
-
125
- | \- | Set object |
126
- | clearable |
127
-
128
- If `true`, then user can clear the value of the input.
129
-
130
- booleanundefined
131
-
132
-
133
-
134
- |
135
-
136
- true
137
-
138
- | Set object |
139
- | color |
140
-
141
- The **`color`** CSS property sets the foreground color value of an element's text and text decorations using the colour tokens from the design system. It also sets the `currentcolor` value. `currentcolor` may be used as an indirect value on _other_ properties and is the default for other color properties, such as `border-color`.
142
-
143
- We recommend using the following token values for best color contrast:
144
-
145
- * `colour.primary.onFill` used on top of `colour.primary.fill` for primary text that needs to stand out
146
- * `colour.primary.text` used on top of `colour.primary.surface` or `colour.neutral.10` for primary text that needs to be less prominent
147
- * `colour.neutral.70` used on top of `colour.neutral.10` or `colour.neutral.20` for muted text
148
- * `colour.neutral.80` used on top of `colour.neutral.10` or `colour.neutral.20` for standard text
149
- * `colour.system.danger.onFill` used on top of `colour.system.danger.fill` for error text that needs to stand out
150
- * `colour.system.danger.text` used on top of `colour.system.danger.surface` for error text that needs to be less prominent
151
- * `colour.system.success.onFill` used on top of `colour.system.success.fill` for success text that needs to stand out
152
- * `colour.system.success.text` used on top of `colour.system.success.surface` for success text that needs to be less prominent
153
- * `colour.system.warning.onFill` used on top of `colour.system.warning.fill` for warning text that needs to stand out
154
- * `colour.system.warning.text` used on top of `colour.system.warning.surface` for warning text that needs to be less prominent
155
- * `colour.system.info.onFill` used on top of `colour.system.info.fill` for informative text that needs to stand out
156
- * `colour.system.info.text` used on top of `colour.system.info.surface` for informative text that needs to be less prominent
157
-
158
- ResponsiveProp<ColorToken> | undefined
159
-
160
- | \- | Set object |
161
- | debounceThreshold |
162
-
163
- Time in milliseconds to wait for before performing result search. Only applies to searchable options (function).
164
-
165
- numberundefined
166
-
167
-
168
-
169
- |
170
-
171
- 500
172
-
173
- | Set object |
174
- | defaultValue |
175
-
176
- The value of the input. Can be a string or a number. Use for uncontrolled inputs.
177
-
178
- stringundefined
179
-
180
-
181
-
182
- | \- | Set object |
183
- | errorText |
184
-
185
- Text to be displayed when the options function errors out. It is not used when the options are provided as an array.
186
-
187
- ReactNode
188
-
189
-
190
-
191
- |
192
-
193
- <IressAlert />
194
-
195
-
196
-
197
- | Set object |
198
- | focusable |
199
-
200
- The `focusable` prop is used to apply the focus elevation when focused. It can be set to `true` to apply focus styles on focus, or `'within'` to apply focus styles when the element or any of its children are focused.
201
-
202
- "true""within"undefined
203
-
204
-
205
-
206
- | \- | Set object |
207
- | formatter |
208
-
209
- Bring your own formatter that will be used to format the value when the input is not focused, allowing you to display the value in a different format. e.g. User type in value="dsf 987kkk123" => result after formatter: $987,123 (string)
210
-
211
- ((value?: string | undefined) => string | number) | undefined
212
-
213
- | \- | \- |
214
- | hide |
215
-
216
- Set **`hide`** to hide an element completely using `display: none`. It can also be set to an object of breakpoints to hide the element at specific breakpoints.
217
-
218
- Hide on all breakpoints: `hide: true` Hide on specific breakpoints: `hide: { xs: false, sm: true, md: false, lg: true, xl: false, xxl: true }`
219
-
220
- Notes:
221
-
222
- * If you need to hide an element but allow it to be visible to screen readers, use the `srOnly` prop instead.
223
- * Consider if you can conditionally render the element instead of hiding it.
224
-
225
- ResponsiveProp<boolean> | undefined
226
-
227
- | \- | Set object |
228
- | initialOptions |
229
-
230
- Initial options data set, shown when the input is empty.
231
-
232
- LabelValueMeta\[\] | undefined
233
-
234
- | \- | Set object |
235
- | inline |
236
-
237
- Make prepend/append element closer to the input content.
238
-
239
- booleanundefined
240
-
241
-
242
-
243
- | \- | Set object |
244
- | layerStyle |
245
-
246
- Elevate a layer by using a **`layerStyle`**. These are connected to the elevation tokens in the design system. They can be combined to create hierarchy and structure.
247
-
248
- * `elevation.raised`: Raised elevations sit slightly higher than other content. They are reserved for cards that can be moved, such as Jira issue cards and Trello cards. In special circumstances, they can be used for cards as a way to provide additional heirarchy or emphasis.
249
- * `elevation.floating`: Floating is the highest elevation available. It is reserved for a UI that sits over another UI, such as modals, dialogs, dropdown menus, floating toolbars, and floating single-action buttons.
250
- * `elevation.overflow`: Overflow is a shadow indicating content has scrolled outside a view. It can be used for vertical or horizontal scroll. An example of overflow shadows is the horizontal scroll in tables on a Confluence page.
251
-
252
- ResponsiveProp<"elevation.raised" | "elevation.floating" | "elevation.overflow" | "elevation.focus" | "elevation.focusCompact"> | undefined
253
-
254
- | \- | Set object |
255
- | limitDesktop |
256
-
257
- Maximum number of results displayed on larger screen sizes (>= 768).
258
-
259
- numberundefined
260
-
261
-
262
-
263
- |
264
-
265
- 12
266
-
267
- | Set object |
268
- | limitMobile |
269
-
270
- Maximum number of results displayed on mobile screen sizes (< 768).
271
-
272
- numberundefined
273
-
274
-
275
-
276
- |
277
-
278
- 6
279
-
280
- | Set object |
281
- | loading |
282
-
283
- The loading states of the input field. If provided a string, will use that text as the loading message.
284
-
285
- stringbooleanundefined
286
-
287
-
288
-
289
- | \- | Set object |
290
- | m |
291
-
292
- The **`m`** property is short for `margin`, and sets the margin area on all four sides of an element.
293
-
294
- It uses the spacing tokens in the design system. You can also use the negative values to overlap elements or ignore padding based on the design requirements.
295
-
296
- | Chrome | Firefox | Safari | Edge | IE |
297
- | --- | --- | --- | --- | --- |
298
- | **1** | **1** | **1** | **12** | **3** |
299
-
300
- ResponsiveProp<SpacingToken | "auto"> | undefined
301
-
302
- | \- | Set object |
303
- | maxWidth |
304
-
305
- The **`max-width`** CSS property sets the maximum width of an element. It prevents the used value of the `width` property from becoming larger than the value specified by `max-width`.
306
-
307
- | Chrome | Firefox | Safari | Edge | IE |
308
- | --- | --- | --- | --- | --- |
309
- | **1** | **1** | **1** | **12** | **7** |
310
-
311
- ResponsiveProp<"auto" | SizeToken | "screen" | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | "1/6" | "2/6" | "3/6" | "4/6" | "5/6" | "1/12" | "2/12" | ... 8 more ... | "11/12"> | undefined
312
-
313
- | \- | Set object |
314
- | mb |
315
-
316
- The **`mb`** property is short for `margin-bottom` and sets the margin area on the bottom side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
317
-
318
- It uses the spacing tokens in the design system.
319
-
320
- | Chrome | Firefox | Safari | Edge | IE |
321
- | --- | --- | --- | --- | --- |
322
- | **1** | **1** | **1** | **12** | **3** |
323
-
324
- ResponsiveProp<SpacingToken | "auto"> | undefined
325
-
326
- | \- | Set object |
327
- | minSearchLength |
328
-
329
- Minimum number of characters required before triggering async search. Only applies to searchable options (function). Below this threshold, no search will be triggered and no loading state will be shown.
330
-
331
- numberundefined
332
-
333
-
334
-
335
- |
336
-
337
- 1
338
-
339
- | Set object |
340
- | ml |
341
-
342
- The **`ml`** property is short for `margin-left` and sets the margin area on the left side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
343
-
344
- It uses the spacing tokens in the design system.
345
-
346
- | Chrome | Firefox | Safari | Edge | IE |
347
- | --- | --- | --- | --- | --- |
348
- | **1** | **1** | **1** | **12** | **3** |
349
-
350
- ResponsiveProp<SpacingToken | "auto"> | undefined
351
-
352
- | \- | Set object |
353
- | mr |
354
-
355
- The **`mr`** property is short for `margin-right` and sets the margin area on the right side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
356
-
357
- It uses the spacing tokens in the design system.
358
-
359
- | Chrome | Firefox | Safari | Edge | IE |
360
- | --- | --- | --- | --- | --- |
361
- | **1** | **1** | **1** | **12** | **3** |
362
-
363
- ResponsiveProp<SpacingToken | "auto"> | undefined
364
-
365
- | \- | Set object |
366
- | mt |
367
-
368
- The **`mt`** property is short for `margin-top` and sets the margin area on the top side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
369
-
370
- It uses the spacing tokens in the design system.
371
-
372
- | Chrome | Firefox | Safari | Edge | IE |
373
- | --- | --- | --- | --- | --- |
374
- | **1** | **1** | **1** | **12** | **3** |
375
-
376
- ResponsiveProp<SpacingToken | "auto"> | undefined
377
-
378
- | \- | Set object |
379
- | mx |
380
-
381
- The **`mx`** property is short for `margin-inline`. It is a shorthand property that defines both the logical inline start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation.
382
-
383
- It uses the spacing tokens in the design system. You can also use the negative values to overlap elements or ignore padding based on the design requirements.
384
-
385
- | Chrome | Firefox | Safari | Edge | IE |
386
- | --- | --- | --- | --- | --- |
387
- | **1** | **1** | **1** | **12** | **3** |
388
-
389
- ResponsiveProp<SpacingToken | "auto"> | undefined
390
-
391
- | \- | Set object |
392
- | my |
393
-
394
- The **`my`** property is short for `margin-block`. It defines the logical block start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation.
395
-
396
- It uses the spacing tokens in the design system. You can also use the negative values to overlap elements or ignore padding based on the design requirements.
397
-
398
- | Chrome | Firefox | Safari | Edge | IE |
399
- | --- | --- | --- | --- | --- |
400
- | **1** | **1** | **1** | **12** | **3** |
401
-
402
- ResponsiveProp<SpacingToken | "auto"> | undefined
403
-
404
- | \- | Set object |
405
- | noGutter |
406
-
407
- The **`noGutter`** property is used to remove the bottom margin from the last child of a component. This is useful when you want to avoid extra spacing at the end of a layout.
408
-
409
- booleanundefined
410
-
411
-
412
-
413
- | \- | Set object |
414
- | noResultsText |
415
-
416
- Text to be displayed when no results are found.
417
-
418
- ReactNode
419
-
420
-
421
-
422
- | \- | Set object |
423
- | onChange |
424
-
425
- Emitted when the user changes the input. The second and third arguments are only available when the options were selected from the `options` prop.
426
-
427
- ((e?: SyntheticEvent<HTMLInputElement, Event> | undefined, value?: string | undefined, option?: LabelValueMeta | undefined) => void) | undefined
428
-
429
- | \- | \- |
430
- | onClear |
431
-
432
- Emitted when the input is manually cleared.
433
-
434
- ((e: ChangeEvent<HTMLInputElement>) => void) | undefined
435
-
436
- | \- | \- |
437
- | options |
438
-
439
- Options data set, shown when the input is not empty.
440
-
441
- LabelValueMeta\[\] | ((query: string) => Promise<LabelValueMeta\[\]>) | undefined
442
-
443
- | \- |
444
-
445
- RAW
446
-
447
- options : \[
448
-
449
- 0 : {...} 1 key
450
-
451
- 1 : {...} 1 key
452
-
453
- 2 : {...} 1 key
454
-
455
- 3 : {...} 1 key
456
-
457
- 4 : {...} 1 key
458
-
459
- \]
460
-
461
-
462
-
463
-
464
-
465
- |
466
- | p |
467
-
468
- The **`p`** property is short for `padding`, and sets the padding area on all four sides of an element at once.
469
-
470
- It uses the spacing tokens in the design system. Padding cannot use negative values, if you need to overlap elements or ignore padding, use the margin property instead.
471
-
472
- | Chrome | Firefox | Safari | Edge | IE |
473
- | --- | --- | --- | --- | --- |
474
- | **1** | **1** | **1** | **12** | **3** |
475
-
476
- ResponsiveProp<"xs" | "sm" | "md" | "lg" | "xl" | "none" | "spacing.000" | "spacing.050" | "spacing.100" | "spacing.150" | "spacing.200" | "spacing.250" | "spacing.300" | "spacing.350" | ... 9 more ... | "slider.tick"> | undefined
477
-
478
- | \- | Set object |
479
- | pb |
480
-
481
- The **`pb`** property is short for `padding-bottom` and sets the padding area on the bottom side of an element.
482
-
483
- It uses the spacing tokens in the design system. Padding cannot use negative values, if you need to overlap elements or ignore padding, use the margin property instead.
484
-
485
- | Chrome | Firefox | Safari | Edge | IE |
486
- | --- | --- | --- | --- | --- |
487
- | **1** | **1** | **1** | **12** | **3** |
488
-
489
- ResponsiveProp<"xs" | "sm" | "md" | "lg" | "xl" | "none" | "spacing.000" | "spacing.050" | "spacing.100" | "spacing.150" | "spacing.200" | "spacing.250" | "spacing.300" | "spacing.350" | ... 9 more ... | "slider.tick"> | undefined
490
-
491
- | \- | Set object |
492
- | pl |
493
-
494
- The **`pl`** property is short for `padding-left` and sets the padding area on the left side of an element.
495
-
496
- It uses the spacing tokens in the design system. Padding cannot use negative values, if you need to overlap elements or ignore padding, use the margin property instead.
497
-
498
- | Chrome | Firefox | Safari | Edge | IE |
499
- | --- | --- | --- | --- | --- |
500
- | **1** | **1** | **1** | **12** | **3** |
501
-
502
- ResponsiveProp<"xs" | "sm" | "md" | "lg" | "xl" | "none" | "spacing.000" | "spacing.050" | "spacing.100" | "spacing.150" | "spacing.200" | "spacing.250" | "spacing.300" | "spacing.350" | ... 9 more ... | "slider.tick"> | undefined
503
-
504
- | \- | Set object |
505
- | popoverProps |
506
-
507
- Customise the IressInputPopover props for your needs.
508
-
509
- AutocompletePopoverPropsundefined
510
-
511
-
512
-
513
- | { } |
514
-
515
- RAW
516
-
517
- popoverProps : {
518
-
519
- container : {...} 0 keys
520
-
521
- }
522
-
523
-
524
-
525
-
526
-
527
- |
528
- | pr |
529
-
530
- The **`pr`** property is short for `padding-right` and sets the padding area on the right side of an element.
531
-
532
- It uses the spacing tokens in the design system. Padding cannot use negative values, if you need to overlap elements or ignore padding, use the margin property instead.
533
-
534
- | Chrome | Firefox | Safari | Edge | IE |
535
- | --- | --- | --- | --- | --- |
536
- | **1** | **1** | **1** | **12** | **3** |
537
-
538
- ResponsiveProp<"xs" | "sm" | "md" | "lg" | "xl" | "none" | "spacing.000" | "spacing.050" | "spacing.100" | "spacing.150" | "spacing.200" | "spacing.250" | "spacing.300" | "spacing.350" | ... 9 more ... | "slider.tick"> | undefined
539
-
540
- | \- | Set object |
541
- | prepend |
542
-
543
- Content to prepended to the input field, usually an icon.
544
-
545
- ReactNode
546
-
547
-
548
-
549
- | \- | Set object |
550
- | pt |
551
-
552
- The **`pt`** property is short for `padding-top` and sets the padding area on the top side of an element.
553
-
554
- It uses the spacing tokens in the design system. Padding cannot use negative values, if you need to overlap elements or ignore padding, use the margin property instead.
555
-
556
- | Chrome | Firefox | Safari | Edge | IE |
557
- | --- | --- | --- | --- | --- |
558
- | **1** | **1** | **1** | **12** | **3** |
559
-
560
- ResponsiveProp<"xs" | "sm" | "md" | "lg" | "xl" | "none" | "spacing.000" | "spacing.050" | "spacing.100" | "spacing.150" | "spacing.200" | "spacing.250" | "spacing.300" | "spacing.350" | ... 9 more ... | "slider.tick"> | undefined
561
-
562
- | \- | Set object |
563
- | px |
564
-
565
- The **`px`** property is short for `padding-inline`. It is a shorthand property that defines both the logical inline start and end paddings of an element, which maps to physical paddings depending on the element's writing mode, directionality, and text orientation.
566
-
567
- It uses the spacing tokens in the design system. Padding cannot use negative values, if you need to overlap elements or ignore padding, use the margin property instead.
568
-
569
- | Chrome | Firefox | Safari | Edge | IE |
570
- | --- | --- | --- | --- | --- |
571
- | **1** | **1** | **1** | **12** | **3** |
572
-
573
- ResponsiveProp<"xs" | "sm" | "md" | "lg" | "xl" | "none" | "spacing.000" | "spacing.050" | "spacing.100" | "spacing.150" | "spacing.200" | "spacing.250" | "spacing.300" | "spacing.350" | ... 9 more ... | "slider.tick"> | undefined
574
-
575
- | \- | Set object |
576
- | py |
577
-
578
- The **`py`** property is short for `padding-block`. It defines the logical block start and end paddings of an element, which maps to physical paddings depending on the element's writing mode, directionality, and text orientation.
579
-
580
- It uses the spacing tokens in the design system. Padding cannot use negative values, if you need to overlap elements or ignore padding, use the margin property instead.
581
-
582
- | Chrome | Firefox | Safari | Edge | IE |
583
- | --- | --- | --- | --- | --- |
584
- | **1** | **1** | **1** | **12** | **3** |
585
-
586
- ResponsiveProp<"xs" | "sm" | "md" | "lg" | "xl" | "none" | "spacing.000" | "spacing.050" | "spacing.100" | "spacing.150" | "spacing.200" | "spacing.250" | "spacing.300" | "spacing.350" | ... 9 more ... | "slider.tick"> | undefined
587
-
588
- | \- | Set object |
589
- | rowGap |
590
-
591
- The **`row-gap`** CSS property sets the size of the gap (gutter) between an element's rows.
592
-
593
- Note: It only has an effect when used as a direct child of a layout component, such as IressRow, IressStack or IressInline.
594
-
595
- | Chrome | Firefox | Safari | Edge | IE |
596
- | --- | --- | --- | --- | --- |
597
- | **47** | **52** | **10.1** | **16** | No |
598
-
599
- ResponsiveProp<"xs" | "sm" | "md" | "lg" | "xl" | "none" | "spacing.000" | "spacing.050" | "spacing.100" | "spacing.150" | "spacing.200" | "spacing.250" | "spacing.300" | "spacing.350" | ... 9 more ... | "slider.tick"> | undefined
600
-
601
- | \- | Set object |
602
- | rows |
603
-
604
- Number of rows in the `textarea` (when set the component renders a textarea element)
605
-
606
- undefined
607
-
608
-
609
-
610
- | \- | Set object |
611
- | srOnly |
612
-
613
- Set **`srOnly`** to hide an element visually but still make it accessible to screen readers. It can also be set to an object of breakpoints to hide the element at specific breakpoints.
614
-
615
- Hide on all breakpoints: `srOnly: true` Hide on specific breakpoints: `srOnly: { xs: false, sm: true, md: false, lg: true, xl: false, xxl: true }`
616
-
617
- ResponsiveProp<boolean> | undefined
618
-
619
- | \- | Set object |
620
- | stretch |
621
-
622
- The **`stretch`** property is used to stretch an element to fill the available space in its parent container. It sets the `height` property to `100%` and `alignSelf` to `stretch`, allowing the element to expand and contract based on the size of its parent.
623
-
624
- booleanundefined
625
-
626
-
627
-
628
- | \- | Set object |
629
- | textAlign |
630
-
631
- The **`text-align`** CSS property sets the horizontal alignment of the inline-level content inside a block element or table-cell box.
632
-
633
- | Chrome | Firefox | Safari | Edge | IE |
634
- | --- | --- | --- | --- | --- |
635
- | **1** | **1** | **1** | **12** | **3** |
636
-
637
- ResponsiveProp<"center" | "left" | "right" | "inherit" | "justify"> | undefined
638
-
639
- | \- | Set object |
640
- | textStyle |
641
-
642
- Select the typography to be used using the **`textStyle`** prop. These are connected to the typography tokens in the design system.'
643
-
644
- * `typography.body.sm` - Use for small components such as badges and disclaimers, as well as compact variations of tables and lists.
645
- * `typography.body.md` - The most commonly used body text size, used for most text content in the product and the default state of all components in the design system.
646
- * `typography.body.lg` - Use for tag lines, subtitles, and other large text content in the product.
647
- * `typography.heading.1` - Use for the main page title to establish a clear hierarchy. There is typically only one H1 per screen, emphasising the primary purpose or context of the page.
648
- * `typography.heading.2` - Use for primary section headings within a page to organise content and guide the user through key areas. Also suitable for large components—such as modals—where space allows and where it pairs well with body.md or body.lg.
649
- * `typography.heading.3` - Use for sub-sections under H2s to further structure content and maintain a clear visual hierarchy. Ideal for breaking down complex sections into manageable parts.
650
- * `typography.heading.4` - Use for supporting headings within content blocks or small components where space is limited—such as table headers, cards, or side panels. Provides structure without overwhelming the layout.
651
- * `typography.heading.5` - Use for minor labels or titles in compact UI elements, such as cards, sidebars, or inline labels. Best used to emphasise supplementary information without drawing too much attention. Works well with body.sm and is ideal for subtle content like fine print. Use sparingly to preserve typographic hierarchy.
652
- * `typography.code` - Used to display code snippets in the product, such as in the API documentation.
653
-
654
- ResponsiveProp<"typography.heading.1" | "typography.heading.2" | "typography.heading.3" | "typography.heading.4" | "typography.heading.5" | "typography.body.sm" | "typography.body.sm.regular" | ... 10 more ... | "typography.code"> | undefined
655
-
656
- | \- | Set object |
657
- | value |
658
-
659
- The value of the input. Can be a string or a number. Use for controlled inputs.
660
-
661
- stringundefined
662
-
663
-
664
-
665
- | \- | Set object |
666
- | width |
667
-
668
- The width of the input.
669
-
670
- "2""4""6""8""10""12""16""25perc"Show 4 more...
671
-
672
-
673
-
674
- | \- | Set object |
675
-
676
- [](#usage)Usage
677
- ---------------
678
-
679
- The `IressAutocomplete` element extends `IressInput` with additional functionality to provide suggestions to the user as they type.
680
-
681
- 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`.
682
-
683
- ### [](#uncontrolled)Uncontrolled
684
-
685
- The `defaultValue` prop can be used to set the initial value of the input. The value will be managed by the component.
686
-
687
- Hide code
688
-
689
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
690
-
691
- <IressAutocomplete
692
- defaultValue\="Option 1"
693
- options\={\[
694
- {
695
- label: 'Option 1'
696
- },
697
- {
698
- label: 'Option 2'
699
- },
700
- {
701
- label: 'Option 3'
702
- },
703
- {
704
- label: 'Option 4'
705
- },
706
- {
707
- label: 'Option 5'
708
- }
709
- \]}
710
- popoverProps\={{
711
- container: document.body
712
- }}
713
- />
714
-
715
- Copy
716
-
717
- ### [](#controlled)Controlled
718
-
719
- 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.
720
-
721
- Hide code
722
-
723
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
724
-
725
- import { IressAutocomplete, IressAutocompleteProps } from '@iress-oss/ids-components';
726
- import { useState } from 'react';
727
- export const AutocompleteUsingState \= () \=> {
728
- const \[value, setValue\] \= useState('Option 1');
729
- return (
730
- <IressAutocomplete
731
- {...{
732
- popoverProps: {
733
- container: document.body,
734
- },
735
- options: \[
736
- {
737
- label: 'Option 1',
738
- },
739
- {
740
- label: 'Option 2',
741
- },
742
- {
743
- label: 'Option 3',
744
- },
745
- {
746
- label: 'Option 4',
747
- },
748
- {
749
- label: 'Option 5',
750
- },
751
- \],
752
- }}
753
- onChange\={(\_e, newValue) \=> setValue(newValue ?? '')}
754
- onClear\={() \=> setValue('')}
755
- value\={value}
756
- />
757
- );
758
- };
759
-
760
- Copy
761
-
762
- ### [](#providing-suggestions)Providing suggestions
763
-
764
- #### [](#options)`options`
765
-
766
- To use the suggestion functionality, you can provide an array of `LabelValueMeta[]` objects to the `options` prop.
767
-
768
- **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.
769
-
770
- Hide code
771
-
772
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
773
-
774
- <IressAutocomplete
775
- options\={\[
776
- {
777
- label: 'Option 1'
778
- },
779
- {
780
- label: 'Option 2'
781
- },
782
- {
783
- label: 'Option 3'
784
- },
785
- {
786
- label: 'Option 4'
787
- },
788
- {
789
- label: 'Option 5'
790
- }
791
- \]}
792
- popoverProps\={{
793
- container: {}
794
- }}
795
- />
796
-
797
- Copy
798
-
799
- #### [](#asynchronous-options)Asynchronous `options`
800
-
801
- 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.
802
-
803
- Hide code
804
-
805
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
806
-
807
- import { IressAutocomplete, IressAutocompleteProps } from '@iress-oss/ids-components';
808
- interface StarWarsCharacter {
809
- name: string;
810
- gender: string;
811
- }
812
- interface StarWarsCharacterApi {
813
- results: StarWarsCharacter\[\];
814
- }
815
- export const AutocompleteUsingAsync \= () \=> (
816
- <IressAutocomplete
817
- {...{
818
- popoverProps: {
819
- container: document.body,
820
- },
821
- placeholder: 'Search star wars characters, or type "error" to see the error text',
822
- }}
823
- options\={async (query: string) \=> {
824
- if (query \=== 'error') {
825
- throw new Error('This is an error');
826
- }
827
- const data \= await fetch(
828
- \`https://swapi.py4e.com/api/people/?search=${query}\`,
829
- ).then((response) \=> response.json() as Promise<StarWarsCharacterApi\>);
830
- return data.results.map((character: StarWarsCharacter) \=> ({
831
- label: character.name,
832
- value: character.name,
833
- meta: character.gender,
834
- }));
835
- }}
836
- />
837
- );
838
-
839
- Copy
840
-
841
- #### [](#minimum-search-length-for-async-options)Minimum search length for async options
842
-
843
- 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.
844
-
845
- 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.
846
-
847
- Hide code
848
-
849
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
850
-
851
- import { IressAutocomplete, IressAutocompleteProps } from '@iress-oss/ids-components';
852
- interface StarWarsCharacter {
853
- name: string;
854
- gender: string;
855
- }
856
- interface StarWarsCharacterApi {
857
- results: StarWarsCharacter\[\];
858
- }
859
- export const AutocompleteUsingAsync \= () \=> (
860
- <IressAutocomplete
861
- {...{
862
- popoverProps: {
863
- container: document.body,
864
- },
865
- minSearchLength: 3,
866
- }}
867
- options\={async (query: string) \=> {
868
- if (query \=== 'error') {
869
- throw new Error('This is an error');
870
- }
871
- const data \= await fetch(
872
- \`https://swapi.py4e.com/api/people/?search=${query}\`,
873
- ).then((response) \=> response.json() as Promise<StarWarsCharacterApi\>);
874
- return data.results.map((character: StarWarsCharacter) \=> ({
875
- label: character.name,
876
- value: character.name,
877
- meta: character.gender,
878
- }));
879
- }}
880
- />
881
- );
882
-
883
- Copy
884
-
885
- #### [](#initialoptions)`initialOptions`
886
-
887
- 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).
888
-
889
- Hide code
890
-
891
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
892
-
893
- <IressAutocomplete
894
- initialOptions\={\[
895
- {
896
- label: 'Favourite option 1'
897
- },
898
- {
899
- label: 'Favourite option 2'
900
- },
901
- {
902
- label: 'Favourite option 3'
903
- }
904
- \]}
905
- options\={\[
906
- {
907
- label: 'Option 1'
908
- },
909
- {
910
- label: 'Option 2'
911
- },
912
- {
913
- label: 'Option 3'
914
- },
915
- {
916
- label: 'Option 4'
917
- },
918
- {
919
- label: 'Option 5'
920
- }
921
- \]}
922
- popoverProps\={{
923
- container: document.body
924
- }}
925
- />
926
-
927
- Copy
928
-
929
- [](#behaviour)Behaviour
930
- -----------------------
931
-
932
- * 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.
933
- * The popover will close when the input is empty, unless `initialOptions` are provided.
934
- * The suggestions will be filtered based on the input value.
935
- * Tapping on a suggestion with the mouse will change the input value to the selection and close the popover.
936
- * When the user presses the arrows keys while the input is focussed, suggestions will be highlighted, but focus remains on the input.
937
- * When the user presses the enter key while a suggestion is highlighted, the suggestion will be selected and the popover will close.
938
- * When the user presses the down key while the popover is closed, it will open the popover.
939
- * When the user pressed the up key while the first suggestion is highlighted, it will close the popover.
940
- * When the user tabs away while no suggestion is highlighted, the input will not be changed.
941
- * When the user tabs away while a suggestion is highlighted, the suggestion will be selected.
942
- * When the user tabs away while the popover is open, the popover will close.
943
-
944
- [](#accessibility)Accessibility
945
- -------------------------------
946
-
947
- 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/).
948
-
949
- There is a key difference:
950
-
951
- * 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.
952
- * To denote the highlighted suggestion to screen readers, the `aria-activedescendant` attribute is used.
953
-
954
- [](#examples)Examples
955
- ---------------------
956
-
957
- ### [](#autoselect)`autoSelect`
958
-
959
- 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.
960
-
961
- Hide code
962
-
963
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
964
-
965
- <IressAutocomplete
966
- autoSelect\={false}
967
- options\={\[
968
- {
969
- label: 'Option 1'
970
- },
971
- {
972
- label: 'Option 2'
973
- },
974
- {
975
- label: 'Option 3'
976
- },
977
- {
978
- label: 'Option 4'
979
- },
980
- {
981
- label: 'Option 5'
982
- }
983
- \]}
984
- placeholder\="Should no longer auto-select when an item is highlighted"
985
- popoverProps\={{
986
- container: document.body
987
- }}
988
- />
989
-
990
- Copy
991
-
992
- ### [](#input-props)Input props
993
-
994
- Autocomplete extends `IressInput`, hence it has the same properties as `IressInput`.
995
-
996
- It does have some defaults to help with user experience. `append` automatically has a search icon, and `clearable` is set to true by default.
997
-
998
- Hide code
999
-
1000
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1001
-
1002
- <IressAutocomplete
1003
- append\={<IressPopover activator\={<IressButton mode\="tertiary"\><IressIcon name\="cog" /></IressButton\>} align\="bottom-end" container\={document.body}\><IressPanel\>Some settings in here</IressPanel\></IressPopover\>}
1004
- options\={\[
1005
- {
1006
- label: 'Option 1'
1007
- },
1008
- {
1009
- label: 'Option 2'
1010
- },
1011
- {
1012
- label: 'Option 3'
1013
- },
1014
- {
1015
- label: 'Option 4'
1016
- },
1017
- {
1018
- label: 'Option 5'
1019
- }
1020
- \]}
1021
- popoverProps\={{
1022
- container: document.body
1023
- }}
1024
- prepend\={<IressIcon name\="search" />}
1025
- width\="12"
1026
- />
1027
-
1028
- Copy
1029
-
1030
- ### [](#no-results)No results
1031
-
1032
- If you would like to show a message when there are no results, you can use the `noResultsText` prop. It accepts any React node.
1033
-
1034
- Hide code
1035
-
1036
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1037
-
1038
- <IressAutocomplete
1039
- noResultsText\={<IressPanel\>No results found</IressPanel\>}
1040
- options\={\[
1041
- {
1042
- label: 'Option 1'
1043
- },
1044
- {
1045
- label: 'Option 2'
1046
- },
1047
- {
1048
- label: 'Option 3'
1049
- },
1050
- {
1051
- label: 'Option 4'
1052
- },
1053
- {
1054
- label: 'Option 5'
1055
- }
1056
- \]}
1057
- placeholder\="Type &quot;no&quot; to see the no results text"
1058
- popoverProps\={{
1059
- container: document.body
1060
- }}
1061
- />
1062
-
1063
- Copy
1064
-
1065
- ### [](#popover-props)Popover props
1066
-
1067
- Under the hood, autocomplete uses `IressInputPopover` to display the suggestions. It accepts `autoHighlight`, `align`, `className` and `displayMode`.
1068
-
1069
- 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.
1070
-
1071
- Hide code
1072
-
1073
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1074
-
1075
- <IressAutocomplete
1076
- options\={\[
1077
- {
1078
- label: 'Option 1'
1079
- },
1080
- {
1081
- label: 'Option 2'
1082
- },
1083
- {
1084
- label: 'Option 3'
1085
- },
1086
- {
1087
- label: 'Option 4'
1088
- },
1089
- {
1090
- label: 'Option 5'
1091
- }
1092
- \]}
1093
- popoverProps\={{
1094
- append: <IressPanel\><IressButton\>Add an option</IressButton\></IressPanel\>,
1095
- container: document.body
1096
- }}
1097
- />
1098
-
1099
- Copy
1100
-
1101
- ### [](#debounce-threshold)Debounce threshold
1102
-
1103
- 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.
1104
-
1105
- By default there is a debounce, but it can be removed by setting it to `0`.
1106
-
1107
- Hide code
1108
-
1109
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1110
-
1111
- <IressAutocomplete
1112
- debounceThreshold\={0}
1113
- options\={\[
1114
- {
1115
- label: 'Option 1'
1116
- },
1117
- {
1118
- label: 'Option 2'
1119
- },
1120
- {
1121
- label: 'Option 3'
1122
- },
1123
- {
1124
- label: 'Option 4'
1125
- },
1126
- {
1127
- label: 'Option 5'
1128
- }
1129
- \]}
1130
- placeholder\="Instant search!"
1131
- popoverProps\={{
1132
- container: {}
1133
- }}
1134
- />
1135
-
1136
- Copy
1137
-
1138
- ### [](#result-limits)Result limits
1139
-
1140
- You can limit the maximum amount of search results displayed in the suggestions by setting the `limitDesktop` prop. This defaults to 12.
1141
-
1142
- On smaller screens (< 768px), the number of options is further reduced by using the `limitMobile` prop, which defaults to 6.
1143
-
1144
- `limitMobile` works by filtering the search results that have been filtered by `limitDesktop`, so must be a smaller value. For example:
1145
-
1146
- \[data-radix-scroll-area-viewport\] {
1147
- scrollbar-width: none;
1148
- -ms-overflow-style: none;
1149
- -webkit-overflow-scrolling: touch;
1150
- }
1151
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
1152
- display: none;
1153
- }
1154
- :where(\[data-radix-scroll-area-viewport\]) {
1155
- display: flex;
1156
- flex-direction: column;
1157
- align-items: stretch;
1158
- }
1159
- :where(\[data-radix-scroll-area-content\]) {
1160
- flex-grow: 1;
1161
- }
1162
-
1163
- // 12 results on large screens, 6 on small screens (default values)
1164
- <IressAutocomplete options\={...} />
1165
- // 4 results on large screens, 3 on small screens
1166
- <IressAutocomplete resultLimitDesktop\={4} resultLimitMobile\={3} options\={...} />
1167
- // 4 results on all screens (resultLimitMobile > resultLimitDesktop so has no effect)
1168
- <IressAutocomplete resultLimitDesktop\={4} resultLimitMobile\={5} options\={...} />
1169
-
1170
- Copy
1171
-
1172
- The result limits will also affect the number of initial options displayed, if the `initialOptions` prop is set.
1173
-
1174
- **xl** breakpoint (1200px - 1499px)
1175
-
1176
- Hide code
1177
-
1178
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1179
-
1180
- <IressStack gap\="md"\>
1181
- <IressPanel\>
1182
- <CurrentBreakpoint />
1183
- </IressPanel\>
1184
- <IressAutocomplete
1185
- limitDesktop\={6}
1186
- limitMobile\={3}
1187
- options\={\[
1188
- {
1189
- label: 'Option 1'
1190
- },
1191
- {
1192
- label: 'Option 2'
1193
- },
1194
- {
1195
- label: 'Option 3'
1196
- },
1197
- {
1198
- label: 'Option 4'
1199
- },
1200
- {
1201
- label: 'Option 5'
1202
- },
1203
- {
1204
- label: 'Option 6'
1205
- },
1206
- {
1207
- label: 'Option 7'
1208
- },
1209
- {
1210
- label: 'Option 8'
1211
- },
1212
- {
1213
- label: 'Option 9'
1214
- },
1215
- {
1216
- label: 'Option 10'
1217
- },
1218
- {
1219
- label: 'Option 11'
1220
- },
1221
- {
1222
- label: 'Option 12'
1223
- },
1224
- {
1225
- label: 'Option 13'
1226
- },
1227
- {
1228
- label: 'Option 14'
1229
- },
1230
- {
1231
- label: 'Option 15'
1232
- }
1233
- \]}
1234
- popoverProps\={{
1235
- container: document.body
1236
- }}
1237
- />
1238
- </IressStack\>
1239
-
1240
- Copy
1241
-
1242
- ### [](#read-only)Read only
1243
-
1244
- 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.
1245
-
1246
- 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).
1247
-
1248
- Option 1
1249
-
1250
- Hide code
1251
-
1252
- \[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
1253
-
1254
- <IressAutocomplete
1255
- defaultValue\="Option 1"
1256
- options\={\[
1257
- {
1258
- label: 'Option 1'
1259
- },
1260
- {
1261
- label: 'Option 2'
1262
- },
1263
- {
1264
- label: 'Option 3'
1265
- },
1266
- {
1267
- label: 'Option 4'
1268
- },
1269
- {
1270
- label: 'Option 5'
1271
- }
1272
- \]}
1273
- popoverProps\={{
1274
- container: document.body
1275
- }}
1276
- readOnly
1277
- />
1278
-
1279
- Copy
1280
-
1281
- [](#testing)Testing
1282
- -------------------
1283
-
1284
- 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.
1285
-
1286
- **Note:** These are suggestions and not requirements. You should test the component in a way that best suits your use case.
1287
-
1288
- ### [](#partial-query-matching)Partial query matching
1289
-
1290
- 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.
1291
-
1292
- If you are using `meta`, `prepend` or `append` props in `LabelValueMeta`, you should also consider this in your search query for the option.
1293
-
1294
- \[data-radix-scroll-area-viewport\] {
1295
- scrollbar-width: none;
1296
- -ms-overflow-style: none;
1297
- -webkit-overflow-scrolling: touch;
1298
- }
1299
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
1300
- display: none;
1301
- }
1302
- :where(\[data-radix-scroll-area-viewport\]) {
1303
- display: flex;
1304
- flex-direction: column;
1305
- align-items: stretch;
1306
- }
1307
- :where(\[data-radix-scroll-area-content\]) {
1308
- flex-grow: 1;
1309
- }
1310
-
1311
- render(
1312
- <IressAutocomplete
1313
- options\={\[
1314
- { label: 'Luke Skywalker', value: 'Luke Skywalker', meta: 'male' },
1315
- \]}
1316
- />,
1317
- );
1318
- const autocomplete \= screen.getByRole('combobox');
1319
- await user.type(autocomplete, 'lu');
1320
- // Exact string match with a space to denote the highlighted value
1321
- const option \= await screen.findByRole('option', {
1322
- name: 'Lu ke Skywalker male',
1323
- });
1324
- expect(option).toBeInTheDocument();
1325
- // Using a regex to match the string
1326
- const option \= await screen.findByRole('option', { name: /Skywalker/ });
1327
- expect(option).toBeInTheDocument();
1328
-
1329
- Copy
1330
-
1331
- ### [](#query-for-minimal-characters)Query for minimal characters
1332
-
1333
- 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.
1334
-
1335
- \[data-radix-scroll-area-viewport\] {
1336
- scrollbar-width: none;
1337
- -ms-overflow-style: none;
1338
- -webkit-overflow-scrolling: touch;
1339
- }
1340
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
1341
- display: none;
1342
- }
1343
- :where(\[data-radix-scroll-area-viewport\]) {
1344
- display: flex;
1345
- flex-direction: column;
1346
- align-items: stretch;
1347
- }
1348
- :where(\[data-radix-scroll-area-content\]) {
1349
- flex-grow: 1;
1350
- }
1351
-
1352
- render(<IressAutocomplete options\={searchStarWarsCharacters} />);
1353
- const autocomplete \= screen.getByRole('combobox');
1354
- // DO: Use the shortest query to return the desired result
1355
- await user.type(autocomplete, 'lu');
1356
- const option \= await screen.findAllByRole('option');
1357
- // DON'T: Use a long query to return the desired result
1358
- await user.type(autocomplete, 'luke skywalker');
1359
- const option \= await screen.findAllByRole('option');
1360
-
1361
- Copy
1362
-
1363
- ### [](#use-mocking-when-testing-apis)Use mocking when testing APIs
1364
-
1365
- 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.
1366
-
1367
- We recommend using [Mock Service Worker](https://mswjs.io/) to mock the API calls in your tests.
1368
-
1369
- \[data-radix-scroll-area-viewport\] {
1370
- scrollbar-width: none;
1371
- -ms-overflow-style: none;
1372
- -webkit-overflow-scrolling: touch;
1373
- }
1374
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
1375
- display: none;
1376
- }
1377
- :where(\[data-radix-scroll-area-viewport\]) {
1378
- display: flex;
1379
- flex-direction: column;
1380
- align-items: stretch;
1381
- }
1382
- :where(\[data-radix-scroll-area-content\]) {
1383
- flex-grow: 1;
1384
- }
1385
-
1386
- // src/mocks/handlers.ts
1387
- import { http, HttpResponse } from 'msw';
1388
- export const handlers \= \[
1389
- // Intercept "GET https://swapi.py4e.com/api/people" requests...
1390
- http.get('https://swapi.py4e.com/api/people', () \=> {
1391
- // ...and respond to them using this JSON response.
1392
- return HttpResponse.json(\[
1393
- { name: 'Luke Skywalker', gender: 'male' },
1394
- { name: 'Leia Skywalker', gender: 'female' },
1395
- \]);
1396
- }),
1397
- \];
1398
- // src/mocks/node.js
1399
- import { setupServer } from 'msw/node';
1400
- import { handlers } from './handlers';
1401
- export const server \= setupServer(...handlers);
1402
- // src/CustomAutocomplete.test.tsx
1403
- import { server } from './mocks/node';
1404
- server.listen();
1405
- render(<IressAutocomplete options\={searchStarWarsCharacters} />);
1406
- const autocomplete \= screen.getByRole('combobox');
1407
- await user.type(autocomplete, 'lu');
1408
- const option \= await screen.findAllByRole('option');
1409
-
1410
- Copy
1411
-
1412
- On this page
1413
-
1414
- * [Overview](#overview)
1415
- * [Props](#props)
1416
- * [Usage](#usage)
1417
- * [Uncontrolled](#uncontrolled)
1418
- * [Controlled](#controlled)
1419
- * [Providing suggestions](#providing-suggestions)
1420
- * [Behaviour](#behaviour)
1421
- * [Accessibility](#accessibility)
1422
- * [Examples](#examples)
1423
- * [autoSelect](#autoselect)
1424
- * [Input props](#input-props)
1425
- * [No results](#no-results)
1426
- * [Popover props](#popover-props)
1427
- * [Debounce threshold](#debounce-threshold)
1428
- * [Result limits](#result-limits)
1429
- * [Read only](#read-only)
1430
- * [Testing](#testing)
1431
- * [Partial query matching](#partial-query-matching)
1432
- * [Query for minimal characters](#query-for-minimal-characters)
1433
- * [Use mocking when testing APIs](#use-mocking-when-testing-apis)