Overview

KMultiSelect is a searchable select component that supports single and multiple selections, flat arrays, and deeply nested hierarchical trees with cascading selection behavior.

Messages

KMultiSelect requires a messages object with 7 required keys, each a function returning a translated string. Additional optional keys enable further live-region announcements.

KMultiSelect messages
Name Required Description Examples
clearText
Yes
aria-label for the clear (×) button.
Clear all selections
open
Yes
aria-label for the open (▼) button.
Open options
close
Yes
aria-label for the close (▲) button.
Close options
clickable
Yes
Accessible description indicating that options are interactive.
Options are clickable
allOptionsSelected
Yes
Announced via live region when every option is selected.
All options selected
allOptionsDeselected
Yes
Announced via live region when no options are selected.
No options selected
optionDeselected
Yes
Announced via live region when an individual option is deselected.
Option deselected
itemsSelected
No
Multiple-select only. Announces how many items are selected as part of the field’s accessible name. Receives { count }.
3 items selected
partiallySelected
No
Renders visually-hidden text inside indeterminate parent nodes so screen readers announce the partial selection state. Use with hierarchical trees.
Partially selected
selected
No
Announced via live region when an option is selected. Receives { label, count }.
Apple selected, 3 total
removed
No
Announced via live region when a chip is removed. Receives { label, count }.
Removed Apple, 2 remaining
cleared
No
Announced via live region when all selections are cleared.
All selections cleared

Usage

Multiple selection

Selecting multiple items from a flat list of objects using itemText and itemValue to map object properties.

Single selection

Selecting a single item from a flat list using :multiple="false". Use appearanceOverrides to constrain the width.

Multi-field search

Searching across multiple fields on each option using the searchKeys prop. Try typing a native script form or a related term to see matches across all configured fields.

Hierarchical tree

Options with a level field render as a nested tree. The autoSelectChild and autoSelectParent props control how a selection cascades through the tree. Use at most one of them, since each gives a checked parent a different meaning.

Cascading selection

With autoSelectChild, selecting or deselecting a parent cascades to its children. A parent is checked when all of its children are selected and indeterminate when only some are, no matter how it was selected.

Independent selection

Without the cascade props, each option is selected on its own, so checking a parent selects only the parent, and a parent you check directly stays checked when its children change. By default, selecting all children of a parent also selects the parent; this example turns that off with :autoPromoteParent="false", so the value stays limited to exactly what you select and a fully covered parent shows as indeterminate.

Automatic parent selection

With autoSelectParent, selecting an option also selects all of the parents above it, so the value always contains the full path to every selected option, ordered from parent to child. A selected parent shows as indeterminate while only some of the options under it are selected. A parent selected this way is removed when the last selected option under it is deselected, while a parent you select directly stays selected. Deselecting a parent deselects everything under it.

Primitive values

Using a flat array of primitive values (numbers or strings) instead of objects. No itemText or itemValue mapping is needed.

Related

  • KSelect for simpler, non-searchable dropdowns without tokenization.
  • KListbox which powers the underlying dropdown menu and keyboard navigation for this component.

Props

Name Description Type Default Required
appearanceOverrides
Custom CSS styles applied to the root container element.
object null
value
The selected value. An array in multiple mode, or a string, number, or null in single mode.
object null
options
Array of option objects or primitive values to display in the dropdown.
array true
searchText
The current search input text.
string ''
multiple
Whether multiple options can be selected.
boolean true
itemText
Key on option objects used as the display label.
string 'label'
itemValue
Key on option objects used to identify each selection.
string 'value'
searchKeys
Additional option object keys to include in search matching. By default, only itemText is searched.
array null
label
Label for the field.
string ''
placeholder
Placeholder text shown in the input when nothing is selected.
string ''
noResultsText
Text shown in the dropdown when the search query has no matching options.
string null
disabled
Whether or not the field is disabled.
boolean false
invalid
Whether or not the current value is invalid.
boolean false
invalidText
Error text shown when invalid is true.
string ''
clearable
Shows a clear button when a value is selected.
boolean false
autoSelectParent
Only applies to hierarchical options. When true, selecting an option also selects all of the parents above it.
boolean false
autoSelectChild
Only applies to hierarchical options. When true, selecting or deselecting a parent also selects or deselects everything under it.
boolean false
autoPromoteParent
Only applies to hierarchical options. When true, selecting all children of a parent selects the parent as well.
boolean true
messages
Localized functions for UI labels and screen reader announcements.
object true
hideSelected
Hides already-selected options from the dropdown. Only supported for flat lists, not nested options.
boolean false

Slots

Name Description
chip
Custom slot for rendering selected items (chips) in multiple select mode.
option
Custom slot for rendering option items in the dropdown menu.
no-results
Optional slot as alternative to noResultsText prop
error
Optional slot as alternative to invalidText prop