# hasChildren Type documentation

## TypeScript declaration

### [hasChildren](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.utils.ts#L17-L17>)

**Kind:** constant

```
import { hasChildren } from '@siemens/element-ng/tree-view';
```

```
(item: TreeItem<any>) => boolean = (item: TreeItem): boolean => item.state !== 'leaf'
```

```
hasChildren(item: TreeItem<any>): boolean
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [item](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.utils.ts#L17-L17>) | `TreeItem<any>` |  |  |

**Returns:** [boolean](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean>)

### Types Documentation

### [TreeItem](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L29-L127>)

**Kind:** interface

```
import type { TreeItem } from '@siemens/element-ng/tree-view';
```

Defines the data for a tree item. All properties are optional.

```
interface TreeItem<T = any>
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [active](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L33-L33>) (optional) | `boolean` | Indicates if the item is active, the last clicked item is active always; only one item can be active. |
| [badge](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L39-L39>) (optional) | `string \| number` | Defines the content of the optional badge. Should be a number or something like "100+". If undefined or empty string, no badge is displayed. |
| [badgeColor](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L46-L46>) (optional) | `string` | Defines the background color of the badge. Use the status color names as inputs.<br><br>See: [https://element.siemens.io/components/status-notifications/badges/](<https://element.siemens.io/components/status-notifications/badges/>) |
| [checked](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L51-L51>) (optional) | `CheckboxState` | The state of the checkbox/optionbox. |
| [children](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L56-L56>) (optional) | `TreeItem<T>[]` | The child tree items. |
| [customData](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L61-L61>) (optional) | `T` | Any custom data that can be used in custom templates. Not shown by default. |
| [dataField1](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L66-L66>) (optional) | `TranslatableString` | The text shown for the tree item data field 1. |
| [dataField2](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L71-L71>) (optional) | `TranslatableString` | The text shown for the tree item data field 2. |
| [icon](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L81-L81>) (optional) | `string` | The web font icon class name (e.g. element-building). The icon is shown on the left (in LTR) side of the label. |
| [label](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L86-L86>) (optional) | `TranslatableString` | The text shown for the tree item label (header). |
| [level](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L76-L76>) (optional) | `number` | The hierarchy level of the node. This will be auto-calculated by the tree view control. |
| [parent](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L91-L91>) (optional) | `TreeItem<T>` | The parent tree item. This will be automatically set by the tree view control. |
| [selectable](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L96-L96>) (optional) | `boolean` | Indicates if the tree item is selectable or not. |
| [selected](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L101-L101>) (optional) | `boolean` | If the item is selected (note that the tree view component supports single and multi-selection). |
| [showCheckbox](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L106-L106>) (optional) | `boolean` | If the tree item shall show a checkbox. |
| [showOptionbox](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L111-L111>) (optional) | `boolean` | If the tree item shall show an optionbox. |
| [state](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L116-L116>) (optional) | `TreeItemFolderState` | The folder state of the tree item. |
| [stateIndicatorColor](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L121-L121>) (optional) | `string` | The color of the state pipe; formatted as CSS value ('red' or '\#FF0000' or 'rgb(255, 0, 0)'). |
| [templateName](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L126-L126>) (optional) | `string` | The name of the template to apply. |

### [CheckboxState](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L20-L20>)

**Kind:** type alias

```
import type { CheckboxState } from '@siemens/element-ng/tree-view';
```

The check box state of a tree item.

```
type CheckboxState = 'unchecked' | 'checked' | 'indeterminate'
```

### [TranslatableString](<https://github.com/siemens/element/blob/main/projects/element-translate-ng/translate-types/global.types.ts#L18-L18>)

**Kind:** type alias

```
import type { TranslatableString } from '@siemens/element-translate-ng/translate-types';
```

Represents a translatable string. This can either be a translation key, e.g. `ACTIONS.EDIT` that will be automatically translated when displayed on the UI or a pre-translated string, e.g. `Edit`. Equivalent to a normal string in usage and functionality.

```
type TranslatableString = string & Translatable
```

### [TreeItemFolderState](<https://github.com/siemens/element/blob/main/projects/element-ng/tree-view/si-tree-view.model.ts#L15-L15>)

**Kind:** type alias

```
import type { TreeItemFolderState } from '@siemens/element-ng/tree-view';
```

The folder state of a tree item.

```
type TreeItemFolderState = 'collapsed' | 'expanding' | 'expanded' | 'leaf'
```
