# ListBox Selection

This article describes the ListBox selection feature, including the available selection modes, and how to use the `SelectedItems` parameter.

## Selection Modes

The ListBox component provides users two ways to select items. This depends on the value of the [`SelectionMode` parameter](https://www.telerik.com/blazor-ui/documentation/components/listbox/overview#listbox-parameters), which expects a member of the `ListBoxSelectionMode` enum.

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Selection Mode | Description                                                                                                                                                                                                                                                                                                                                                                            |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Single`       | Users can select only one ListBox item. They can change the selected item, but cannot deselect the selected one. You can [use a custom toolbar button](https://www.telerik.com/blazor-ui/documentation/components/listbox/toolbar#custom-tools) to clear the selection. See the [example below](https://www.telerik.com/blazor-ui/documentation/components/listbox/selection#example). |
| `Multiple`     | Users can select any number of items. The ListBox supports selection of adjacent items with `Shift` or non-adjacent items with `Ctrl` (`Cmd` on a Mac). Use mouse clicks or the arrow keys, as described on the [ListBox Keyboard Navigation demo](https://demos.telerik.com/blazor-ui/listbox/keyboard-navigation).                                                                   |

## SelectedItems Parameter

The `SelectedItems` parameter of the ListBox supports two-way binding. In this case, the component will update the `SelectedItems` parameter value automatically when the user changes the current selection. If you use `SelectedItems` with one-way binding, you must subscribe to the [`SelectedItemsChanged` event](https://www.telerik.com/blazor-ui/documentation/components/listbox/events#selecteditemschanged) to update the `SelectedItems` parameter value manually on each user selection.

> The ListBox `SelectedItems` parameter must be defined as `IEnumerable<T>` in the application. Unlike the `Data` parameter, it cannot be a `List<T>`, because the built-in `SelectedItemsChanged` handler that is used with two-way binding is defined in the ListBox source code as `EventCallback<IEnumerable<T>>`.

## Example

> caption Using ListBox SelectionMode and Custom Deselect Tool

<demo metaUrl="client/listbox/selection/" height="550px"></demo>

## Next Steps

* [Connect Multiple ListBoxes](https://www.telerik.com/blazor-ui/documentation/components/listbox/connect)
* [Enable ListBox drag-and-drop](https://www.telerik.com/blazor-ui/documentation/components/listbox/drag-drop)
* [Implement ListBox templates](https://www.telerik.com/blazor-ui/documentation/components/listbox/templates)
* [Handle ListBox events](https://www.telerik.com/blazor-ui/documentation/components/listbox/events)

## See Also

* [Live Demo: ListBox Selection](https://demos.telerik.com/blazor-ui/listbox/selection)
* [Live Demo: ListBox Keyboard Navigation](https://demos.telerik.com/blazor-ui/listbox/keyboard-navigation)
* [KB: ListBox CheckBox Selection](https://www.telerik.com/blazor-ui/documentation/knowledge-base/listbox-checkbox-selection)
* [KB: Scroll to Selected ListBox Item](https://www.telerik.com/blazor-ui/documentation/knowledge-base/listbox-scroll-to-selected-item)
