@iress-oss/ids-mcp-server 5.15.0 → 6.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/package.json +28 -46
  2. package/generated/docs/components-alert-docs.md +0 -130
  3. package/generated/docs/components-autocomplete-docs.md +0 -754
  4. package/generated/docs/components-autocomplete-recipes-docs.md +0 -104
  5. package/generated/docs/components-badge-docs.md +0 -148
  6. package/generated/docs/components-button-docs.md +0 -362
  7. package/generated/docs/components-button-recipes-docs.md +0 -76
  8. package/generated/docs/components-buttongroup-docs.md +0 -310
  9. package/generated/docs/components-card-docs.md +0 -494
  10. package/generated/docs/components-card-recipes-docs.md +0 -89
  11. package/generated/docs/components-checkbox-docs.md +0 -193
  12. package/generated/docs/components-checkboxgroup-docs.md +0 -692
  13. package/generated/docs/components-checkboxgroup-recipes-docs.md +0 -119
  14. package/generated/docs/components-col-docs.md +0 -466
  15. package/generated/docs/components-combobox-docs.md +0 -1016
  16. package/generated/docs/components-container-docs.md +0 -91
  17. package/generated/docs/components-divider-docs.md +0 -176
  18. package/generated/docs/components-expander-docs.md +0 -215
  19. package/generated/docs/components-field-docs.md +0 -675
  20. package/generated/docs/components-filter-docs.md +0 -1109
  21. package/generated/docs/components-form-docs.md +0 -2410
  22. package/generated/docs/components-form-recipes-docs.md +0 -886
  23. package/generated/docs/components-hide-docs.md +0 -265
  24. package/generated/docs/components-icon-docs.md +0 -553
  25. package/generated/docs/components-inline-docs.md +0 -868
  26. package/generated/docs/components-input-docs.md +0 -335
  27. package/generated/docs/components-input-recipes-docs.md +0 -140
  28. package/generated/docs/components-inputcurrency-docs.md +0 -157
  29. package/generated/docs/components-inputcurrency-recipes-docs.md +0 -116
  30. package/generated/docs/components-label-docs.md +0 -135
  31. package/generated/docs/components-menu-docs.md +0 -704
  32. package/generated/docs/components-menu-menuitem-docs.md +0 -193
  33. package/generated/docs/components-modal-docs.md +0 -587
  34. package/generated/docs/components-navbar-docs.md +0 -291
  35. package/generated/docs/components-navbar-recipes-docs.md +0 -413
  36. package/generated/docs/components-panel-docs.md +0 -380
  37. package/generated/docs/components-placeholder-docs.md +0 -27
  38. package/generated/docs/components-popover-docs.md +0 -464
  39. package/generated/docs/components-popover-recipes-docs.md +0 -245
  40. package/generated/docs/components-progress-docs.md +0 -104
  41. package/generated/docs/components-provider-docs.md +0 -105
  42. package/generated/docs/components-radio-docs.md +0 -107
  43. package/generated/docs/components-radiogroup-docs.md +0 -683
  44. package/generated/docs/components-readonly-docs.md +0 -89
  45. package/generated/docs/components-richselect-docs.md +0 -2433
  46. package/generated/docs/components-row-docs.md +0 -877
  47. package/generated/docs/components-select-docs.md +0 -456
  48. package/generated/docs/components-skeleton-docs.md +0 -214
  49. package/generated/docs/components-skeleton-recipes-docs.md +0 -76
  50. package/generated/docs/components-skiplink-docs.md +0 -66
  51. package/generated/docs/components-slideout-docs.md +0 -538
  52. package/generated/docs/components-slider-docs.md +0 -346
  53. package/generated/docs/components-spinner-docs.md +0 -59
  54. package/generated/docs/components-stack-docs.md +0 -265
  55. package/generated/docs/components-table-ag-grid-docs.md +0 -1074
  56. package/generated/docs/components-table-docs.md +0 -1305
  57. package/generated/docs/components-tabset-docs.md +0 -341
  58. package/generated/docs/components-tabset-tab-docs.md +0 -86
  59. package/generated/docs/components-tag-docs.md +0 -115
  60. package/generated/docs/components-text-docs.md +0 -394
  61. package/generated/docs/components-toaster-docs.md +0 -345
  62. package/generated/docs/components-toaster-toast-docs.md +0 -157
  63. package/generated/docs/components-toggle-docs.md +0 -158
  64. package/generated/docs/components-tooltip-docs.md +0 -311
  65. package/generated/docs/components-validationmessage-docs.md +0 -241
  66. package/generated/docs/contact-us-docs.md +0 -27
  67. package/generated/docs/extensions-editor-docs.md +0 -288
  68. package/generated/docs/extensions-editor-recipes-docs.md +0 -39
  69. package/generated/docs/foundations-accessibility-docs.md +0 -62
  70. package/generated/docs/foundations-colours-docs.md +0 -257
  71. package/generated/docs/foundations-consistency-docs.md +0 -52
  72. package/generated/docs/foundations-content-docs.md +0 -23
  73. package/generated/docs/foundations-introduction-docs.md +0 -17
  74. package/generated/docs/foundations-principles-docs.md +0 -70
  75. package/generated/docs/foundations-typography-docs.md +0 -191
  76. package/generated/docs/foundations-user-experience-docs.md +0 -63
  77. package/generated/docs/foundations-visual-design-docs.md +0 -46
  78. package/generated/docs/frequently-asked-questions-docs.md +0 -53
  79. package/generated/docs/get-started-develop-docs.md +0 -209
  80. package/generated/docs/get-started-using-storybook-docs.md +0 -68
  81. package/generated/docs/guidelines.md +0 -812
  82. package/generated/docs/introduction-docs.md +0 -43
  83. package/generated/docs/patterns-loading-docs.md +0 -1304
  84. package/generated/docs/resources-changelog-docs.md +0 -6
  85. package/generated/docs/resources-code-katas-docs.md +0 -29
  86. package/generated/docs/resources-migration-guides-from-v4-to-v5-docs.md +0 -437
  87. package/generated/docs/themes-available-themes-docs.md +0 -66
  88. package/generated/docs/themes-introduction-docs.md +0 -121
  89. package/generated/docs/themes-tokens-docs.md +0 -1200
  90. package/generated/docs/versions-docs.md +0 -17
  91. /package/{LICENSE.txt → LICENSE} +0 -0
@@ -1,1016 +0,0 @@
1
- [](#combobox)Combobox
2
- =====================
3
-
4
- Overview
5
- --------
6
-
7
- Comboboxes provide select and multi-select functionality with the benefit of live filtering.
8
-
9
- * * *
10
-
11
- Caution
12
-
13
- Use IressRichSelect instead
14
-
15
- The design of this component is changing. Please use the new component instead.
16
-
17
- None selected
18
-
19
- Hide code
20
-
21
- \[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; }
22
-
23
- <IressCombobox
24
- options\={\[
25
- {
26
- label: 'Option 1',
27
- value: 1
28
- },
29
- {
30
- label: 'Option 2',
31
- value: 2
32
- },
33
- {
34
- label: 'Option 3',
35
- value: 3
36
- },
37
- {
38
- label: 'Option 4',
39
- value: 4
40
- },
41
- {
42
- label: 'Option 5',
43
- value: 5
44
- }
45
- \]}
46
- popoverProps\={{
47
- container: document.body
48
- }}
49
- />
50
-
51
- Copy
52
-
53
- [](#usage)Usage
54
- ---------------
55
-
56
- `IressCombobox` is an alternative to `IressSelect` when you have a large number of options and want to provide a search functionality to help the user find the option they are looking for.
57
-
58
- It extends `IressAutocomplete`, however it restricts the input to the options provided. This means that the user can only select from the options provided. If you do not need this restriction, please use `IressAutocomplete`.
59
-
60
- ### [](#uncontrolled)Uncontrolled
61
-
62
- The `defaultValue` prop can be used to set the initial value of the combobox. The value will be managed by the component.
63
-
64
- **Note:** The `defaultValue` prop is not checked against the options provided, allowing it to work with asynchronous options.
65
-
66
- ×Clear
67
-
68
- None selected
69
-
70
- Hide code
71
-
72
- \[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; }
73
-
74
- <IressCombobox
75
- defaultValue\={{
76
- label: 'Option 1',
77
- value: 1
78
- }}
79
- options\={\[
80
- {
81
- label: 'Option 1',
82
- value: 1
83
- },
84
- {
85
- label: 'Option 2',
86
- value: 2
87
- },
88
- {
89
- label: 'Option 3',
90
- value: 3
91
- },
92
- {
93
- label: 'Option 4',
94
- value: 4
95
- },
96
- {
97
- label: 'Option 5',
98
- value: 5
99
- }
100
- \]}
101
- popoverProps\={{
102
- container: document.body
103
- }}
104
- />
105
-
106
- Copy
107
-
108
- ### [](#controlled)Controlled
109
-
110
- 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.
111
-
112
- **Note:** The `value` prop is not checked against the options provided, allowing it to work with asynchronous options.
113
-
114
- None selected
115
-
116
- Hide code
117
-
118
- \[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; }
119
-
120
- import { IressCombobox, IressComboboxProps, LabelValueMeta } from '@iress-oss/ids-components';
121
- import { useState } from 'react';
122
- export const ComboboxUsingState \= () \=> {
123
- const \[value, setValue\] \= useState<LabelValueMeta | undefined\>();
124
- return (
125
- <IressCombobox
126
- {...{
127
- popoverProps: {
128
- container: document.body,
129
- },
130
- options: \[
131
- {
132
- label: 'Option 1',
133
- value: 1,
134
- },
135
- {
136
- label: 'Option 2',
137
- value: 2,
138
- },
139
- {
140
- label: 'Option 3',
141
- value: 3,
142
- },
143
- {
144
- label: 'Option 4',
145
- value: 4,
146
- },
147
- {
148
- label: 'Option 5',
149
- value: 5,
150
- },
151
- \],
152
- }}
153
- onChange\={(\_e, newValue) \=> setValue(newValue)}
154
- onClear\={() \=> setValue(undefined)}
155
- value\={value}
156
- />
157
- );
158
- };
159
-
160
- Copy
161
-
162
- ### [](#providing-options)Providing options
163
-
164
- #### [](#options)`options`
165
-
166
- The `options` prop is required for the combobox. You can provide an array of `LabelValueMeta[]` objects to the `options` prop. Filtering is done based on the `label` property.
167
-
168
- None selected
169
-
170
- Hide code
171
-
172
- \[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; }
173
-
174
- <IressCombobox
175
- options\={\[
176
- {
177
- label: 'Option 1',
178
- value: 1
179
- },
180
- {
181
- label: 'Option 2',
182
- value: 2
183
- },
184
- {
185
- label: 'Option 3',
186
- value: 3
187
- },
188
- {
189
- label: 'Option 4',
190
- value: 4
191
- },
192
- {
193
- label: 'Option 5',
194
- value: 5
195
- }
196
- \]}
197
- popoverProps\={{
198
- container: document.body
199
- }}
200
- />
201
-
202
- Copy
203
-
204
- #### [](#asynchronous-options)Asynchronous `options`
205
-
206
- 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. No filtering is done for asynchronous options, you must filter the options yourself using the query.
207
-
208
- None selected
209
-
210
- Hide code
211
-
212
- \[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; }
213
-
214
- import { IressCombobox, IressComboboxProps } from '@iress-oss/ids-components';
215
- interface StarWarsCharacter {
216
- name: string;
217
- gender: string;
218
- }
219
- interface StarWarsCharacterApi {
220
- results: StarWarsCharacter\[\];
221
- }
222
- export const ComboboxUsingAsync \= (args: IressComboboxProps) \=> (
223
- <IressCombobox
224
- {...args}
225
- options\={async (query: string) \=> {
226
- if (!query) return \[\];
227
- const data \= await fetch(
228
- \`https://swapi.py4e.com/api/people/?search=${query}\`,
229
- ).then((response) \=> response.json() as Promise<StarWarsCharacterApi\>);
230
- return data.results.map((character: StarWarsCharacter) \=> ({
231
- label: character.name,
232
- value: character.name,
233
- meta: character.gender,
234
- }));
235
- }}
236
- />
237
- );
238
-
239
- Copy
240
-
241
- #### [](#initialoptions)`initialOptions`
242
-
243
- 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).
244
-
245
- **Note:** Once an option is selected from `initialOptions`, the input will be updated, meaning that the user can no longer see the initial options. If you want to keep the initial options visible, you should make sure they are part of the `options` prop as well.
246
-
247
- None selected
248
-
249
- Hide code
250
-
251
- \[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; }
252
-
253
- <IressCombobox
254
- initialOptions\={\[
255
- {
256
- label: 'Favourite option 1'
257
- },
258
- {
259
- label: 'Favourite option 2'
260
- },
261
- {
262
- label: 'Favourite option 3'
263
- }
264
- \]}
265
- options\={\[
266
- {
267
- label: 'Option 1',
268
- value: 1
269
- },
270
- {
271
- label: 'Option 2',
272
- value: 2
273
- },
274
- {
275
- label: 'Option 3',
276
- value: 3
277
- },
278
- {
279
- label: 'Option 4',
280
- value: 4
281
- },
282
- {
283
- label: 'Option 5',
284
- value: 5
285
- }
286
- \]}
287
- popoverProps\={{
288
- container: {}
289
- }}
290
- />
291
-
292
- Copy
293
-
294
- [](#behaviour)Behaviour
295
- -----------------------
296
-
297
- * If `initialOptions` are provided the options will be displayed in a popover immediately on focus. The popover will close when the input loses focus.
298
- * If `initialOptions` are not provided, the popover will be displayed as long as there is a single character in the input. The popover will close when the input is empty.
299
- * The options will be filtered based on the input value.
300
- * If `autoSelect` is true, the first option filtered will become the value of the combobox, unless the backspace key is pressed.
301
- * Tapping on an option with the mouse will change the input value to the `label` of the selected option. The entire `LabelValueMeta` of the selected option will be returned in the `onChange` callback.
302
- * When the user presses the arrow keys while the input is focussed, options will be selected, but focus remains on the input.
303
- * If `autoSelect` is true, the option will become the value of the combobox.
304
- * If `autoSelect` is true, the text not matching the input will be selected.
305
- * When the user presses the enter key while a option is highlighted, the option will be selected and the popover will close.
306
- * When the user presses the down key while the popover is closed, it will open the popover.
307
- * When the user pressed the up key while the first option is highlighted, it will close the popover.
308
- * When the user tabs away while the popover is open, the popover will close.
309
- * If `autoSelect` is true and there is a highlighted option, it will become the value of the combobox.
310
-
311
- [](#accessibility)Accessibility
312
- -------------------------------
313
-
314
- The autocomplete component follows the [WAI combobox pattern: List with inline autocomplete and automatic selection](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/#:~:text=List%20autocomplete%20with%20automatic,has%20a%20selected%20state). 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-both/).
315
-
316
- There is a key difference:
317
-
318
- * 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.
319
- * To denote the highlighted suggestion to screen readers, the `aria-activedescendant` attribute is used.
320
-
321
- [](#examples)Examples
322
- ---------------------
323
-
324
- ### [](#remove-autoselect)Remove `autoSelect`
325
-
326
- The `autoSelect` prop will automatically select the highlighted option. This is set to true by default, but can be switched off, in which case the user must interact with the popover to select an option.
327
-
328
- None selected
329
-
330
- Hide code
331
-
332
- \[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; }
333
-
334
- <IressCombobox
335
- autoSelect\={false}
336
- options\={\[
337
- {
338
- label: 'Option 1',
339
- value: 1
340
- },
341
- {
342
- label: 'Option 2',
343
- value: 2
344
- },
345
- {
346
- label: 'Option 3',
347
- value: 3
348
- },
349
- {
350
- label: 'Option 4',
351
- value: 4
352
- },
353
- {
354
- label: 'Option 5',
355
- value: 5
356
- }
357
- \]}
358
- placeholder\="Should no longer auto-select when an item is highlighted"
359
- popoverProps\={{
360
- container: document.body
361
- }}
362
- />
363
-
364
- Copy
365
-
366
- ### [](#input-props)Input props
367
-
368
- Autocomplete extends `IressInput`, hence it has the same properties as `IressInput`.
369
-
370
- 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.
371
-
372
- None selected
373
-
374
- Hide code
375
-
376
- \[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; }
377
-
378
- <IressCombobox
379
- 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\>}
380
- options\={\[
381
- {
382
- label: 'Option 1',
383
- value: 1
384
- },
385
- {
386
- label: 'Option 2',
387
- value: 2
388
- },
389
- {
390
- label: 'Option 3',
391
- value: 3
392
- },
393
- {
394
- label: 'Option 4',
395
- value: 4
396
- },
397
- {
398
- label: 'Option 5',
399
- value: 5
400
- }
401
- \]}
402
- popoverProps\={{
403
- container: document.body
404
- }}
405
- prepend\={<IressIcon name\="search" />}
406
- width\="12"
407
- />
408
-
409
- Copy
410
-
411
- ### [](#no-results)No results
412
-
413
- If you would like to show a message when there are no results, you can use the `noResultsText` prop. It accepts any React node.
414
-
415
- None selected
416
-
417
- Hide code
418
-
419
- \[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; }
420
-
421
- <IressCombobox
422
- noResultsText\={<IressPanel className\="iress-u-text"\>No results found</IressPanel\>}
423
- options\={\[
424
- {
425
- label: 'Option 1',
426
- value: 1
427
- },
428
- {
429
- label: 'Option 2',
430
- value: 2
431
- },
432
- {
433
- label: 'Option 3',
434
- value: 3
435
- },
436
- {
437
- label: 'Option 4',
438
- value: 4
439
- },
440
- {
441
- label: 'Option 5',
442
- value: 5
443
- }
444
- \]}
445
- placeholder\="Type &quot;no&quot; to see the no results text"
446
- popoverProps\={{
447
- container: document.body
448
- }}
449
- />
450
-
451
- Copy
452
-
453
- ### [](#popover-props)Popover props
454
-
455
- Under the hood, autocomplete uses `IressInputPopover` to display the suggestions. It accepts `autoHighlight`, `align`, `className` and `displayMode`.
456
-
457
- 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.
458
-
459
- None selected
460
-
461
- Hide code
462
-
463
- \[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; }
464
-
465
- <IressCombobox
466
- options\={\[
467
- {
468
- label: 'Option 1',
469
- value: 1
470
- },
471
- {
472
- label: 'Option 2',
473
- value: 2
474
- },
475
- {
476
- label: 'Option 3',
477
- value: 3
478
- },
479
- {
480
- label: 'Option 4',
481
- value: 4
482
- },
483
- {
484
- label: 'Option 5',
485
- value: 5
486
- }
487
- \]}
488
- popoverProps\={{
489
- append: <IressPanel\><IressButton\>Add an option</IressButton\></IressPanel\>,
490
- container: document.body
491
- }}
492
- />
493
-
494
- Copy
495
-
496
- ### [](#debounce-threshold)Debounce threshold
497
-
498
- 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.
499
-
500
- By default there is a debounce of `500`ms, but it can be removed by setting it to `0`.
501
-
502
- **Note:** Removing the debounce and keeping `autoSelect` true may cause some weird highlighting issues if the user types quickly.
503
-
504
- None selected
505
-
506
- Hide code
507
-
508
- \[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; }
509
-
510
- <IressCombobox
511
- debounceThreshold\={0}
512
- options\={\[
513
- {
514
- label: 'Option 1',
515
- value: 1
516
- },
517
- {
518
- label: 'Option 2',
519
- value: 2
520
- },
521
- {
522
- label: 'Option 3',
523
- value: 3
524
- },
525
- {
526
- label: 'Option 4',
527
- value: 4
528
- },
529
- {
530
- label: 'Option 5',
531
- value: 5
532
- }
533
- \]}
534
- placeholder\="Instant search!"
535
- popoverProps\={{
536
- container: document.body
537
- }}
538
- />
539
-
540
- Copy
541
-
542
- ### [](#result-limits)Result limits
543
-
544
- You can limit the maximum amount of search results displayed in the suggestions by setting the `limitDesktop` prop. This defaults to 12.
545
-
546
- On smaller screens (< 768px), the number of options is further reduced by using the `limitMobile` prop, which defaults to 6.
547
-
548
- `limitMobile` works by filtering the search results that have been filtered by `limitDesktop`, so must be a smaller value. For example:
549
-
550
- \[data-radix-scroll-area-viewport\] {
551
- scrollbar-width: none;
552
- -ms-overflow-style: none;
553
- -webkit-overflow-scrolling: touch;
554
- }
555
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
556
- display: none;
557
- }
558
- :where(\[data-radix-scroll-area-viewport\]) {
559
- display: flex;
560
- flex-direction: column;
561
- align-items: stretch;
562
- }
563
- :where(\[data-radix-scroll-area-content\]) {
564
- flex-grow: 1;
565
- }
566
-
567
- // 12 results on large screens, 6 on small screens (default values)
568
- <IressCombobox options\={...} />
569
- // 4 results on large screens, 3 on small screens
570
- <IressCombobox limitDesktop\={4} limitMobile\={3} options\={...} />
571
- // 4 results on all screens (resultLimitMobile > resultLimitDesktop so has no effect)
572
- <IressCombobox limitDesktop\={4} limitMobile\={5} options\={...} />
573
-
574
- Copy
575
-
576
- The result limits will also affect the number of initial options displayed, if the `initialOptions` prop is set.
577
-
578
- **xl** breakpoint (1200px - 1499px)
579
-
580
- None selected
581
-
582
- Hide code
583
-
584
- \[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; }
585
-
586
- <IressStack gutter\="md"\>
587
- <IressPanel className\="iress-u-text"\>
588
- <CurrentBreakpoint />
589
- </IressPanel\>
590
- <IressCombobox
591
- limitDesktop\={6}
592
- limitMobile\={3}
593
- options\={\[
594
- {
595
- label: 'Option 1'
596
- },
597
- {
598
- label: 'Option 2'
599
- },
600
- {
601
- label: 'Option 3'
602
- },
603
- {
604
- label: 'Option 4'
605
- },
606
- {
607
- label: 'Option 5'
608
- },
609
- {
610
- label: 'Option 6'
611
- },
612
- {
613
- label: 'Option 7'
614
- },
615
- {
616
- label: 'Option 8'
617
- },
618
- {
619
- label: 'Option 9'
620
- },
621
- {
622
- label: 'Option 10'
623
- },
624
- {
625
- label: 'Option 11'
626
- },
627
- {
628
- label: 'Option 12'
629
- },
630
- {
631
- label: 'Option 13'
632
- },
633
- {
634
- label: 'Option 14'
635
- },
636
- {
637
- label: 'Option 15'
638
- }
639
- \]}
640
- popoverProps\={{
641
- container: document.body
642
- }}
643
- />
644
- </IressStack\>
645
-
646
- Copy
647
-
648
- ### [](#readonly)Readonly
649
-
650
- The `readOnly` prop can be set 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.
651
-
652
- 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).
653
-
654
- Option 1
655
-
656
- Hide code
657
-
658
- \[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; }
659
-
660
- <IressCombobox
661
- defaultValue\={{
662
- label: 'Option 1',
663
- value: 1
664
- }}
665
- options\={\[
666
- {
667
- label: 'Option 1',
668
- value: 1
669
- },
670
- {
671
- label: 'Option 2',
672
- value: 2
673
- },
674
- {
675
- label: 'Option 3',
676
- value: 3
677
- },
678
- {
679
- label: 'Option 4',
680
- value: 4
681
- },
682
- {
683
- label: 'Option 5',
684
- value: 5
685
- }
686
- \]}
687
- popoverProps\={{
688
- container: document.body
689
- }}
690
- readOnly
691
- />
692
-
693
- Copy
694
-
695
- [](#iressmulticombobox)`IressMultiCombobox`
696
- -------------------------------------------
697
-
698
- `IressMultiCombobox` is a multi-select version of `IressCombobox`. It allows the user to select multiple options from a list. The selected items will be displayed as tags, as well as within the popover.
699
-
700
- * * *
701
-
702
- Caution
703
-
704
- Use IressRichSelect instead
705
-
706
- The design of this component is changing. Please use the new component instead.
707
-
708
- None selected
709
-
710
- Hide code
711
-
712
- \[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; }
713
-
714
- <IressMultiCombobox
715
- options\={\[
716
- {
717
- label: 'Option 1',
718
- value: 1
719
- },
720
- {
721
- label: 'Option 2',
722
- value: 2
723
- },
724
- {
725
- label: 'Option 3',
726
- value: 3
727
- },
728
- {
729
- label: 'Option 4',
730
- value: 4
731
- },
732
- {
733
- label: 'Option 5',
734
- value: 5
735
- }
736
- \]}
737
- popoverProps\={{
738
- container: {}
739
- }}
740
- />
741
-
742
- Copy
743
-
744
- ### [](#tag-limit)Tag limit
745
-
746
- When combobox is in multi-select mode and the number of selected options exceeds the `multiOptionTagLimit` (`4` by default), the view will switch from a collection of tags to a single aggregate tag with a count of the number of selected options.
747
-
748
- The text displayed in the single tag can be modified using the `selectedOptionsTagText` prop (it is set to `options selected` by default).
749
-
750
- 3 options selected
751
-
752
- None selected
753
-
754
- Hide code
755
-
756
- \[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; }
757
-
758
- <IressMultiCombobox
759
- defaultValue\={\[
760
- {
761
- label: 'Option 1',
762
- value: 1
763
- },
764
- {
765
- label: 'Option 2',
766
- value: 2
767
- },
768
- {
769
- label: 'Option 3',
770
- value: 3
771
- }
772
- \]}
773
- multiOptionTagLimit\={2}
774
- options\={\[
775
- {
776
- label: 'Option 1',
777
- value: 1
778
- },
779
- {
780
- label: 'Option 2',
781
- value: 2
782
- },
783
- {
784
- label: 'Option 3',
785
- value: 3
786
- },
787
- {
788
- label: 'Option 4',
789
- value: 4
790
- },
791
- {
792
- label: 'Option 5',
793
- value: 5
794
- }
795
- \]}
796
- popoverProps\={{
797
- container: document.body
798
- }}
799
- selectedOptionsTagText\="options selected"
800
- />
801
-
802
- Copy
803
-
804
- ### [](#readonly-1)Readonly
805
-
806
- The `readOnly` prop can be set to prevent the user from changing the value of the multi-combobox. This will change the input to a custom read-only style and the user will not be able to interact with the input. Multiple values are seperated by a comma.
807
-
808
- 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).
809
-
810
- Option 1, Option 2, Option 3
811
-
812
- Hide code
813
-
814
- \[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; }
815
-
816
- <IressMultiCombobox
817
- defaultValue\={\[
818
- {
819
- label: 'Option 1',
820
- value: 1
821
- },
822
- {
823
- label: 'Option 2',
824
- value: 2
825
- },
826
- {
827
- label: 'Option 3',
828
- value: 3
829
- }
830
- \]}
831
- options\={\[
832
- {
833
- label: 'Option 1',
834
- value: 1
835
- },
836
- {
837
- label: 'Option 2',
838
- value: 2
839
- },
840
- {
841
- label: 'Option 3',
842
- value: 3
843
- },
844
- {
845
- label: 'Option 4',
846
- value: 4
847
- },
848
- {
849
- label: 'Option 5',
850
- value: 5
851
- }
852
- \]}
853
- popoverProps\={{
854
- container: document.body
855
- }}
856
- readOnly
857
- />
858
-
859
- Copy
860
-
861
- [](#testing)Testing
862
- -------------------
863
-
864
- To help you effectively test the combobox component, we have provided a few tips based on the behaviour of the component and our own experience.
865
-
866
- **Note:** These are suggestions and not requirements. You should test the component in a way that best suits your use case.
867
-
868
- ### [](#partial-query-matching)Partial query matching
869
-
870
- 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.
871
-
872
- If you are using `meta`, `prepend` or `append` props in `LabelValueMeta`, you should also consider this in your search query for the option.
873
-
874
- \[data-radix-scroll-area-viewport\] {
875
- scrollbar-width: none;
876
- -ms-overflow-style: none;
877
- -webkit-overflow-scrolling: touch;
878
- }
879
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
880
- display: none;
881
- }
882
- :where(\[data-radix-scroll-area-viewport\]) {
883
- display: flex;
884
- flex-direction: column;
885
- align-items: stretch;
886
- }
887
- :where(\[data-radix-scroll-area-content\]) {
888
- flex-grow: 1;
889
- }
890
-
891
- render(
892
- <IressCombobox
893
- options\={\[
894
- { label: 'Luke Skywalker', value: 'Luke Skywalker', meta: 'male' },
895
- \]}
896
- />,
897
- );
898
- const autocomplete \= screen.getByRole('combobox');
899
- await user.type(autocomplete, 'lu');
900
- // Exact string match with a space to denote the highlighted value
901
- const option \= await screen.findByRole('option', {
902
- name: 'Lu ke Skywalker male',
903
- });
904
- expect(option).toBeInTheDocument();
905
- // Using a regex to match the string
906
- const option \= await screen.findByRole('option', { name: /Skywalker/ });
907
- expect(option).toBeInTheDocument();
908
-
909
- Copy
910
-
911
- ### [](#query-for-minimal-characters)Query for minimal characters
912
-
913
- 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.
914
-
915
- \[data-radix-scroll-area-viewport\] {
916
- scrollbar-width: none;
917
- -ms-overflow-style: none;
918
- -webkit-overflow-scrolling: touch;
919
- }
920
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
921
- display: none;
922
- }
923
- :where(\[data-radix-scroll-area-viewport\]) {
924
- display: flex;
925
- flex-direction: column;
926
- align-items: stretch;
927
- }
928
- :where(\[data-radix-scroll-area-content\]) {
929
- flex-grow: 1;
930
- }
931
-
932
- render(<IressCombobox options\={searchStarWarsCharacters} />);
933
- const autocomplete \= screen.getByRole('combobox');
934
- // DO: Use the shortest query to return the desired result
935
- await user.type(autocomplete, 'lu');
936
- const option \= await screen.findAllByRole('option');
937
- // DON'T: Use a long query to return the desired result
938
- await user.type(autocomplete, 'luke skywalker');
939
- const option \= await screen.findAllByRole('option');
940
-
941
- Copy
942
-
943
- ### [](#use-mocking-when-testing-apis)Use mocking when testing APIs
944
-
945
- 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.
946
-
947
- We recommend using [Mock Service Worker](https://mswjs.io/) to mock the API calls in your tests.
948
-
949
- \[data-radix-scroll-area-viewport\] {
950
- scrollbar-width: none;
951
- -ms-overflow-style: none;
952
- -webkit-overflow-scrolling: touch;
953
- }
954
- \[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
955
- display: none;
956
- }
957
- :where(\[data-radix-scroll-area-viewport\]) {
958
- display: flex;
959
- flex-direction: column;
960
- align-items: stretch;
961
- }
962
- :where(\[data-radix-scroll-area-content\]) {
963
- flex-grow: 1;
964
- }
965
-
966
- // src/mocks/handlers.ts
967
- import { http, HttpResponse } from 'msw';
968
- export const handlers \= \[
969
- // Intercept "GET https://swapi.py4e.com/api/people" requests...
970
- http.get('https://swapi.py4e.com/api/people', () \=> {
971
- // ...and respond to them using this JSON response.
972
- return HttpResponse.json(\[
973
- { name: 'Luke Skywalker', gender: 'male' },
974
- { name: 'Leia Skywalker', gender: 'female' },
975
- \]);
976
- }),
977
- \];
978
- // src/mocks/node.js
979
- import { setupServer } from 'msw/node';
980
- import { handlers } from './handlers';
981
- export const server \= setupServer(...handlers);
982
- // src/CustomAutocomplete.test.tsx
983
- import { server } from './mocks/node';
984
- server.listen();
985
- render(<IressCombobox options\={searchStarWarsCharacters} />);
986
- const autocomplete \= screen.getByRole('combobox');
987
- await user.type(autocomplete, 'lu');
988
- const option \= await screen.findAllByRole('option');
989
-
990
- Copy
991
-
992
- On this page
993
-
994
- * [Overview](#overview)
995
- * [Props](#props)
996
- * [Usage](#usage)
997
- * [Uncontrolled](#uncontrolled)
998
- * [Controlled](#controlled)
999
- * [Providing options](#providing-options)
1000
- * [Behaviour](#behaviour)
1001
- * [Accessibility](#accessibility)
1002
- * [Examples](#examples)
1003
- * [Remove autoSelect](#remove-autoselect)
1004
- * [Input props](#input-props)
1005
- * [No results](#no-results)
1006
- * [Popover props](#popover-props)
1007
- * [Debounce threshold](#debounce-threshold)
1008
- * [Result limits](#result-limits)
1009
- * [Readonly](#readonly)
1010
- * [IressMultiCombobox](#iressmulticombobox)
1011
- * [Tag limit](#tag-limit)
1012
- * [Readonly](#readonly-1)
1013
- * [Testing](#testing)
1014
- * [Partial query matching](#partial-query-matching)
1015
- * [Query for minimal characters](#query-for-minimal-characters)
1016
- * [Use mocking when testing APIs](#use-mocking-when-testing-apis)