# Selection

The TreeList enables the user to select single or multiple cells and rows. It also provides default selection implementation from the `getSelectedState` utility function.

## Getting Started

The TreeList selection can be enabled by:

1. Set the [`selectable`](https://www.telerik.com/kendo-react-ui-develop/components/treelist/api/treelistprops#selectable) option.
2. Set the[`selectedField`](https://www.telerik.com/kendo-react-ui-develop/components/treelist/api/treelistprops#selectedfield) option.
3. Use the [`onSelectionChange`](https://www.telerik.com/kendo-react-ui-develop/components/treelist/api/treelistselectionchangeevent) event.
4. Optionally use the [`getSelectedState`](https://www.telerik.com/kendo-react-ui-develop/components/datatools/api/getselectedstate) utility function for default selection behavior.

As a result, the TreeList allows you to:

* Select single cell or row
* Select multiple cells or rows
* Select range of cells or rows by dragging

The `selectedField` option represents a field inside the data collection which determines the rows that will render as selected.

[Demo Source](https://demos.telerik.com/kendo-react-ui/treelist/selection-basic/func/source.txt)

## Customizing the Selection

The TreeList provides both checkbox and row-click selection options which can be applied to single or multiple records.

The checkbox selection enables selection upon a checkbox click and implements a master checkbox in the header that selects and deselects all items.

To configure the checkbox selection:

1. Set a selection column by setting the `field` option and passing the `select` value to `field`.
2. Handle the [`TreeListSelectionChangeEvent`](https://www.telerik.com/kendo-react-ui-develop/components/treelist/api/treelistselectionchangeevent) and the [`onHeaderSelectionChange`](https://www.telerik.com/kendo-react-ui-develop/components/treelist/api/treelistheaderselectionchangeevent) events which will be fired once the user clicks a checkbox.
3. Depending on the selected state of an item, set the [`selectedField`](https://www.telerik.com/kendo-react-ui-develop/components/treelist/api/treelistprops#selectedfield) value.

The following example demonstrates how to implement multiple selection both on row click and with checkboxes.

[Demo Source](https://demos.telerik.com/kendo-react-ui/treelist/selection/func/source.txt)

## Suggested Links

* [API Reference of the TreeList](https://www.telerik.com/kendo-react-ui-develop/components/treelist/api/treelistprops)
