Selection
The ListBox provides single and multiple item selection modes that allow users to select one or more items from the list.
To configure the selection mode, use the selectable input. The ListBox supports the following selection modes:
single(default)—Allows the user to select only one item at a time.multiple—Allows the user to select multiple items.
Single Selection
By default, the ListBox uses single selection mode. Users can select one item at a time by clicking on it.
The following example demonstrates the single selection mode in action.
Multiple Selection
To enable multiple selection, set the selectable input to multiple. Users can select multiple items by holding Ctrl or Cmd (MacOS) while clicking, or by using keyboard shortcuts such as Ctrl + Space, Shift + Click, or Shift + Arrow keys. Read more about keyboard navigation...
<kendo-listbox [data]="items" selectable="multiple"></kendo-listbox>
The following example demonstrates the multiple selection mode in action.
Programmatic Selection
The ListBox provides methods and fields to programmatically access and manipulate the selected items:
selectedIndices—Provides access to the indices of the currently selected items as an array of numbers.select(indices)—Accepts an array of numbers that correspond to indices in the ListBox and selects them.
The following example demonstrates how to use these APIs to programmatically select items and react to selection changes.
Persisting Selection
The ListBox selection state can be persisted across page refreshes or sessions. The following example demonstrates how to save and restore the selected indices using localStorage. You can also use other storage mechanisms such as sessionStorage, cookies, or backend APIs to persist the selection state.