# Row Selection

The [Angular TreeList](https://www.telerik.com/kendo-angular-ui/components/treelist) provides the user with multiple interaction options to select rows:

<Row>
  <Column count={[24,24,8]} style={{marginBottom: "1rem"}}>
    <Component className="tile" href="#single-row-selection">
      <ComponentTitle>Single Row Selection</ComponentTitle>
      <ComponentDescription style={{padding: "0 10px 10px 10px"}}>Enable users to select one row at a time using click, checkbox, or keyboard navigation.</ComponentDescription>
    </Component>
  </Column>
  <Column count={[24,24,8]} style={{marginBottom: "1rem"}}>
    <Component className="tile" href="#multiple-rows-selection">
      <ComponentTitle>Multiple Rows Selection</ComponentTitle>
      <ComponentDescription style={{padding: "0 10px 10px 10px"}}>Select multiple rows individually, in ranges, or with drag selection using keyboard modifiers.</ComponentDescription>
    </Component>
  </Column>
  <Column count={[24,24,8]} style={{marginBottom: "1rem"}}>
    <Component className="tile" href="#checkbox-only-selection">
      <ComponentTitle>Checkbox-Only Selection</ComponentTitle>
      <ComponentDescription style={{padding: "0 10px 10px 10px"}}>Restrict row selection to checkboxes only, preventing selection through row clicks.</ComponentDescription>
    </Component>
  </Column>
  <Column count={[24,24,8]} style={{marginBottom: "1rem"}}>
    <Component className="tile" href="#select-all-checkbox">
      <ComponentTitle>Select-All Checkbox</ComponentTitle>
      <ComponentDescription style={{padding: "0 10px 10px 10px"}}>Add a header checkbox to select or deselect all items at once.</ComponentDescription>
    </Component>
  </Column>
  <Column count={[24,24,8]} style={{marginBottom: "1rem"}}>
    <Component className="tile" href="#checkbox-selection-of-child-rows">
      <ComponentTitle>Checkbox Selection of Child Rows</ComponentTitle>
      <ComponentDescription style={{padding: "0 10px 10px 10px"}}>Automatically select or deselect child rows when the parent checkbox is toggled.</ComponentDescription>
    </Component>
  </Column>
</Row>

The following example demonstrates the row selection in action.

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

## Single Row Selection

To select a row in single selection mode, use one of the following actions:

* Click the row.
* Select the row's checkbox.
* Press `Space` on the row (available only when [Keyboard Navigation](https://www.telerik.com/kendo-angular-ui/components/treelist/keyboard-navigation) is enabled).

To deselect a row in single selection mode, use one of the following actions:

* Deselect the checkbox of the selected row.
* Press and hold `Ctrl/Cmd(MacOS)`, then click the selected row.
* Press `Ctrl + Space` or `Cmd + Enter` (MacOS) on the row (available only when [Keyboard Navigation](https://www.telerik.com/kendo-angular-ui/components/treelist/keyboard-navigation) is enabled).

> note Clicking a selected row will not deselect it.

The following example demonstrates how to select or deselect a single row using the actions described above.

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

## Multiple Rows Selection

The following table summarizes the available actions for selecting multiple rows in the TreeList:

| Action                          | Description                                                                                                     | Keyboard/Mouse Interaction                                                                                                                                                                                                                                                             | Requirements                                                                                                                                                                                                                                                                           |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Select multiple rows one by one | Select rows individually without affecting other selected rows.                                                 | • Select the checkbox of each desired row.<br>• Press and hold `Ctrl/Cmd(MacOS)`, and click the desired rows.<br>• Press `Shift + Space` on the desired rows.                                                                                                                          | Requires [Keyboard Navigation](https://www.telerik.com/kendo-angular-ui/components/treelist/keyboard-navigation) for `Shift + Space`.                                                                                                                                                  |
| Select a range of rows          | Select a continuous range of rows by defining a start and end point. Any new selection resets the previous one. | • Click and drag the rectangular selection over the desired rows.<br>• Select a row, then press and hold `Shift` and click the last row in the range.<br>• Press `Space` to select a row, navigate with arrow keys, and press `Ctrl + Space` or `Cmd + Enter` (MacOS) on the last row. | • Drag selection requires the [`drag`](https://www.telerik.com/kendo-angular-ui/components/treelist/api/selectablesettings#drag) option.<br>• Requires [Keyboard Navigation](https://www.telerik.com/kendo-angular-ui/components/treelist/keyboard-navigation) for keyboard shortcuts. |
| Deselect a row                  | Remove a specific row from the selection.                                                                       | • Deselect the checkbox of the specific row.<br>• Press and hold `Ctrl/Cmd(MacOS)`, then click the specific row.<br>• Press `Ctrl + Space` or `Cmd + Enter` (MacOS) on the desired row.                                                                                                | Requires [Keyboard Navigation](https://www.telerik.com/kendo-angular-ui/components/treelist/keyboard-navigation) for `Ctrl + Space` / `Cmd + Enter`.                                                                                                                                   |
| Leave only one row selected     | Deselect all previously selected rows and keep only the current row selected.                                   | • Click a row within the TreeList.<br>• Press `Space` to select the active row.                                                                                                                                                                                                        | Requires [Keyboard Navigation](https://www.telerik.com/kendo-angular-ui/components/treelist/keyboard-navigation) for `Space`.                                                                                                                                                          |

The following example demonstrates how to select and deselect multiple rows using the actions described above.

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

## Checkbox-Only Selection

The TreeList component provides the ability to select rows only through a dedicated checkbox associated with each respective row. To enable the checkbox-only selection, set the [`checkboxOnly`](https://www.telerik.com/kendo-angular-ui/components/treelist/api/selectablesettings#checkboxonly) property to `true`.

```html
<kendo-treelist
    [data]="data"
    [selectable]="{ checkboxOnly: true }"
    kendoTreeListSelectable
>
    <kendo-treelist-checkbox-column [width]="35"></kendo-treelist-checkbox-column>
    ...
</kendo-treelist>
```

You can combine the checkbox-only selection with single or multiple selection mode. To select rows in the TreeList when checkbox-only selection is enabled, use the checkboxes of the desired rows.

> Checkbox selection is supported only in row selection mode and is not compatible with [cell selection mode](https://www.telerik.com/kendo-angular-ui/components/treelist/selection/cell-selection).

The following example demonstrates the checkbox-only option with single row selection.

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

## Select-All Checkbox

The TreeList allows the selection or deselection of all items through a select-all checkbox in its header. To enable the select-all feature, set the [`showSelectAll`](https://www.telerik.com/kendo-angular-ui/components/treelist/api/checkboxcolumncomponent#showselectall) option of [`CheckboxColumnComponent`](https://www.telerik.com/kendo-angular-ui/components/treelist/api/checkboxcolumncomponent) to `true`.

> note The TreeList select-all checkbox selects all loaded items across all pages. When `checkChildren` is set to `true`, clicking the select-all checkbox also triggers the loading and selection of child nodes.

The following example demonstrates how to apply the default behavior of the select-all checkbox.

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

## Checkbox Selection of Child Rows

The TreeList allows the selection or deselection of child items through the checkbox of the parent item. To enable the selection of child rows, set the [`checkChildren`](https://www.telerik.com/kendo-angular-ui/components/treelist/api/checkboxcolumncomponent#checkchildren) option of [`CheckboxColumnComponent`](https://www.telerik.com/kendo-angular-ui/components/treelist/api/checkboxcolumncomponent) to `true`.

> Selecting a node will trigger the loading of child nodes if `checkChildren` is set to `true`.

The following example demonstrates checkbox selection for child rows.

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

## Suggested Links

* [`SelectableDirective`](https://www.telerik.com/kendo-angular-ui/components/treelist/api/selectabledirective)
* [`SelectableSettings`](https://www.telerik.com/kendo-angular-ui/components/treelist/api/selectablesettings)
* [API Reference of the `TreeListComponent`](https://www.telerik.com/kendo-angular-ui/components/treelist/api/treelistcomponent)
* [API Index of the TreeList](https://www.telerik.com/kendo-angular-ui/components/treelist/api)
