let
| Yes | null | HTMLDivElement
| null
| Obtain a reference to the list HTML element |
-| ref | let
| Yes | null | HTMLInputElement
| null
| Obtain a reference to the input HTML element |
-| open | let
| Yes | boolean
| false
| Set to `true` to open the combobox menu dropdown |
-| value | let
| Yes | string
| ""
| Specify the selected combobox value |
-| selectedId | let
| Yes | ComboBoxItemId
| undefined
| Set the selected item by value id |
-| items | let
| No | ComboBoxItem[]
| []
| Set the combobox items |
-| itemToString | let
| No | (item: ComboBoxItem) => string
| (item) => item.text || item.id
| Override the display of a combobox item |
-| direction | let
| No | "bottom" | "top"
| "bottom"
| Specify the direction of the combobox dropdown menu |
-| size | let
| No | "sm" | "xl"
| undefined
| Set the size of the combobox |
-| disabled | let
| No | boolean
| false
| Set to `true` to disable the combobox |
-| titleText | let
| No | string
| ""
| Specify the title text of the combobox |
-| placeholder | let
| No | string
| ""
| Specify the placeholder text |
-| helperText | let
| No | string
| ""
| Specify the helper text |
-| invalidText | let
| No | string
| ""
| Specify the invalid state text |
-| invalid | let
| No | boolean
| false
| Set to `true` to indicate an invalid state |
-| warn | let
| No | boolean
| false
| Set to `true` to indicate an warning state |
-| warnText | let
| No | string
| ""
| Specify the warning state text |
-| light | let
| No | boolean
| false
| Set to `true` to enable the light variant |
-| shouldFilterItem | let
| No | (item: ComboBoxItem, value: string) => boolean
| () => true
| Determine if an item should be filtered given the current combobox value |
-| translateWithId | let
| No | (id: import("../ListBox/ListBoxMenuIcon.svelte").ListBoxMenuIconTranslationId) => string
| undefined
| Override the chevron icon label based on the open state.let
| No | (id: any) => string
| undefined
| Override the menu label based on the open state.let
| No | (id: "clearSelection") => string
| undefined
| Override the label of the clear button when the input has a selection.let
| No | string
| "ccs-" + Math.random().toString(36)
| Set an id for the list box component |
-| name | let
| No | string
| undefined
| Specify a name attribute for the input |
-| clear | function
| No | (options?: { focus?: boolean; }) => void
| () => { prevSelectedId = null; highlightedIndex = -1; highlightedId = undefined; selectedId = undefined; selectedItem = undefined; open = false; inputValue = ""; if (options?.focus !== false) ref?.focus(); }
| Clear the combo box programmatically |
+| Prop name | Kind | Reactive | Type | Default value | Description |
+| :------------------- | :-------------------- | :------- | :---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| listRef | let
| Yes | null | HTMLDivElement
| null
| Obtain a reference to the list HTML element |
+| ref | let
| Yes | null | HTMLInputElement
| null
| Obtain a reference to the input HTML element |
+| open | let
| Yes | boolean
| false
| Set to `true` to open the combobox menu dropdown |
+| value | let
| Yes | string
| ""
| Specify the selected combobox value |
+| selectedId | let
| Yes | ComboBoxItemId
| undefined
| Set the selected item by value id |
+| items | let
| No | ComboBoxItem[]
| []
| Set the combobox items |
+| itemToString | let
| No | (item: ComboBoxItem) => string
| (item) => item.text || item.id
| Override the display of a combobox item |
+| direction | let
| No | "bottom" | "top"
| "bottom"
| Specify the direction of the combobox dropdown menu |
+| size | let
| No | "sm" | "xl"
| undefined
| Set the size of the combobox |
+| disabled | let
| No | boolean
| false
| Set to `true` to disable the combobox |
+| titleText | let
| No | string
| ""
| Specify the title text of the combobox |
+| placeholder | let
| No | string
| ""
| Specify the placeholder text |
+| helperText | let
| No | string
| ""
| Specify the helper text |
+| invalidText | let
| No | string
| ""
| Specify the invalid state text |
+| invalid | let
| No | boolean
| false
| Set to `true` to indicate an invalid state |
+| warn | let
| No | boolean
| false
| Set to `true` to indicate an warning state |
+| warnText | let
| No | string
| ""
| Specify the warning state text |
+| light | let
| No | boolean
| false
| Set to `true` to enable the light variant |
+| shouldFilterItem | let
| No | (item: ComboBoxItem, value: string) => boolean
| () => true
| Determine if an item should be filtered given the current combobox value |
+| translateWithId | let
| No | (id: import("../ListBox/ListBoxMenuIcon.svelte").ListBoxMenuIconTranslationId) => string
| undefined
| Override the chevron icon label based on the open state.let
| No | (id: "clearSelection") => string
| undefined
| Override the label of the clear button when the input has a selection.let
| No | string
| "ccs-" + Math.random().toString(36)
| Set an id for the list box component |
+| name | let
| No | string
| undefined
| Specify a name attribute for the input |
+| clear | function
| No | (options?: { focus?: boolean; }) => void
| () => { prevSelectedId = null; highlightedIndex = -1; highlightedId = undefined; selectedId = undefined; selectedItem = undefined; open = false; inputValue = ""; if (options?.focus !== false) ref?.focus(); }
| Clear the combo box programmatically |
### Slots
@@ -2352,7 +2351,6 @@ export interface MultiSelectItem {
| placeholder | let
| No | string
| ""
| Specify the placeholder text |
| sortItem | let
| No | ((a: MultiSelectItem, b: MultiSelectItem) => MultiSelectItem) | (() => void)
| (a, b) => a.text.localeCompare(b.text, locale, { numeric: true })
| Override the sorting logiclet
| No | (id: import("../ListBox/ListBoxMenuIcon.svelte").ListBoxMenuIconTranslationId) => string
| undefined
| Override the chevron icon label based on the open state.let
| No | (id: any) => string
| undefined
| Override the default translation ids for the menu |
| translateWithIdInput | let
| No | (id: import("../ListBox/ListBoxSelection.svelte").ListBoxSelectionTranslationId) => string
| undefined
| Override the label of the clear button when the input has a selection.let
| No | string
| ""
| Specify the title text |
| useTitleInItem | let
| No | boolean
| false
| Set to `true` to pass the item to `itemToString` in the checkbox |
diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json
index f4f2d149..fd4e5360 100644
--- a/docs/src/COMPONENT_API.json
+++ b/docs/src/COMPONENT_API.json
@@ -1562,20 +1562,10 @@
"constant": false,
"reactive": false
},
- {
- "name": "translateWithIdMenu",
- "kind": "let",
- "description": "Override the menu label based on the open state.\nDefaults to \"Open menu\" and \"Close menu\"",
- "type": "(id: any) => string",
- "isFunction": false,
- "isFunctionDeclaration": false,
- "constant": false,
- "reactive": false
- },
{
"name": "translateWithIdInput",
"kind": "let",
- "description": "Override the label of the clear button when the input has a selection.\nDefaults to \"Clear selected item\"",
+ "description": "Override the label of the clear button when the input has a selection.\nDefaults to \"Clear selected item\" since a combo box can only have on selection.",
"type": "(id: \"clearSelection\") => string",
"isFunction": false,
"isFunctionDeclaration": false,
@@ -6610,16 +6600,6 @@
"constant": false,
"reactive": false
},
- {
- "name": "translateWithIdMenu",
- "kind": "let",
- "description": "Override the default translation ids for the menu",
- "type": "(id: any) => string",
- "isFunction": false,
- "isFunctionDeclaration": false,
- "constant": false,
- "reactive": false
- },
{
"name": "translateWithIdInput",
"kind": "let",
diff --git a/tests/ComboBox.test.svelte b/tests/ComboBox.test.svelte
index 337a3f82..64923ea8 100644
--- a/tests/ComboBox.test.svelte
+++ b/tests/ComboBox.test.svelte
@@ -27,9 +27,6 @@
console.log(id); // "open" | "close"
return id;
}}"
- translateWithIdMenu="{(id) => {
- return id;
- }}"
translateWithIdInput="{(id) => {
console.log(id); // "clearSelection"
return id;
diff --git a/tests/MultiSelect.test.svelte b/tests/MultiSelect.test.svelte
index d5faf0fa..27d306c2 100644
--- a/tests/MultiSelect.test.svelte
+++ b/tests/MultiSelect.test.svelte
@@ -24,9 +24,6 @@
console.log(id); // "open" | "close"
return id;
}}"
- translateWithIdMenu="{(id) => {
- return id;
- }}"
translateWithIdInput="{(id) => {
console.log(id); // "clearAll" | "clearSelection"
return id;