# Configuring the ToolBar in the Angular TreeList

Starting with version [`17.0.0`](https://www.telerik.com/kendo-angular-ui/components/changelogs/kendo-angular-ui#v17.0.0), you can use the [ToolBar](https://www.telerik.com/kendo-angular-ui/components/toolbar/toolbar) component in the [Kendo UI for Angular TreeList](https://www.telerik.com/kendo-angular-ui/components/treelist) instead of the [toolbar template](https://www.telerik.com/kendo-angular-ui/components/treelist/toolbar/toolbar-template). The ToolBar offers a set of built-in features and control types, and also allows you to include custom controls to enhance the TreeList's functionality.

To use the ToolBar component in the TreeList, define the `kendo-toolbar` component inside the `<kendo-treelist>` tag, add the desired elements, and configure them.

```html
<kendo-treelist>
    <kendo-toolbar>
    </kendo-toolbar>
</kendo-treelist>
```

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

## Built-In TreeList Toolbar Tools

With the introduction of the ToolBar component in the TreeList, new directives have been added to integrate dedicated toolbar tools for performing common data operations. The following tables list all of the available built-in directives of the TreeList's toolbar:

<table>
    <thead>
        <tr>
            <th style="width: 25%">Toolbar Tool</th>
            <th style="width: 75%">Description</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><a href="/treelist/api/pdfcommandtoolbardirective"><code>kendoTreeListPDFTool</code></a></td>
            <td>Directive that triggers the TreeList's <a href="/treelist/export/pdf-export">PDF export</a> feature.</td>
        </tr>
        <tr>
            <td><a href="/treelist/api/excelcommandtoolbardirective"><code>kendoTreeListExcelTool</code></a></td>
            <td>Directive that triggers the TreeList's <a href="/treelist/export/excel-export">Excel export</a> feature.</td>
        </tr>
        <tr>
            <td><a href="/treelist/api/addcommandtoolbardirective"><code>kendoTreeListAddTool</code></a></td>
            <td>Directive for adding a new item to the TreeList. Triggers the TreeList's <a href="/treelist/api/treelistcomponent#add"><code>add</code></a> event.</td>
        </tr>
    </tbody>
</table>

## Including the Built-In Toolbar Tools

You can integrate each directive as a toolbar tool in the TreeList by applying it to a [`<kendo-toolbar-button>`](https://www.telerik.com/kendo-angular-ui/components/toolbar/api/toolbarbuttoncomponent) component, nested within the TreeList's toolbar:

```html
<kendo-treelist>
    <kendo-toolbar>
        <kendo-toolbar-button kendoTreeListAddTool></kendo-toolbar-button>
        <kendo-toolbar-separator></kendo-toolbar-separator>
        <kendo-toolbar-spacer></kendo-toolbar-spacer>
        <kendo-toolbar-button kendoTreeListPDFTool></kendo-toolbar-button>
        <kendo-toolbar-button kendoTreeListExcelTool></kendo-toolbar-button>
    </kendo-toolbar>
</kendo-treelist>
```

## Customizing the Toolbar Tools Rendering

You can control the visibility of the text and icons for the tools displayed in the TreeList's toolbar or in its overflow popup. To customize the appearance of an individual toolbar tool, use the [`showText`](https://www.telerik.com/kendo-angular-ui/components/toolbar/api/toolbarbuttoncomponent#showtext) or [`showIcon`](https://www.telerik.com/kendo-angular-ui/components/toolbar/api/toolbarbuttoncomponent#showicon) properties of the corresponding tool.

You can also define the [`showText`](https://www.telerik.com/kendo-angular-ui/components/toolbar/api/toolbarcomponent#showtext) and [`showIcon`](https://www.telerik.com/kendo-angular-ui/components/toolbar/api/toolbarcomponent#showicon) properties on the ToolBar component to customize the appearance of all tools globally.

The `showText` and `showIcon` properties accept the following values of type [`DisplayMode`](https://www.telerik.com/kendo-angular-ui/components/toolbar/api/displaymode):

* `always`—The text or icon is always visible, regardless of the overflow mode set for the ToolBar.
* `toolbar`—The text or icon is displayed in the ToolBar and in the overflow popup if [`section`](https://www.telerik.com/kendo-angular-ui/components/toolbar/toolbar/responsive-toolbar#section-mode) overflow mode is used.
* `menu`—The text or icon is displayed only in the overflow popup if [`menu`](https://www.telerik.com/kendo-angular-ui/components/toolbar/toolbar/responsive-toolbar#menu-mode) overflow mode is used.
* `never`—The text or icon is never displayed.

```html HTML
<kendo-treelist>
    <kendo-toolbar [showText]="showText" [showIcon]="showIcon">
        ...
    </kendo-toolbar>
</kendo-treelist>
```

```ts TypeScript
public showText: DisplayMode = "menu";
public showIcon: DisplayMode = "always";
```

The following example demonstrates how the icons and text of the TreeList toolbar tools behave depending on the values of the `showText` and `showIcon` properties.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/treelist/toolbar/toolbar-tools/custom-tools-rendering/source.txt)

## Implementing a Responsive ToolBar in TreeList

The TreeList's toolbar inherits the responsive behavior of the ToolBar component and supports all of the different [overflow modes](https://www.telerik.com/kendo-angular-ui/components/toolbar/toolbar/responsive-toolbar) that the ToolBar provides. The available overflow modes are:

* [Scroll Mode](https://www.telerik.com/kendo-angular-ui/components/toolbar/toolbar/responsive-toolbar#scroll-mode)—The ToolBar becomes scrollable, which allows you to display all tools regardless of the component's width.
* [Section Mode](https://www.telerik.com/kendo-angular-ui/components/toolbar/toolbar/responsive-toolbar#section-mode)—The toolbar tools that do not fit the component's width are displayed in a popup element while maintaining their initial rendering.
* [Menu Mode](https://www.telerik.com/kendo-angular-ui/components/toolbar/toolbar/responsive-toolbar#menu-mode)—The toolbar tools that do not fit the component's width are displayed in a popup list.

The following example demonstrates the behavior of the TreeList's toolbar when the overflow mode is set to `section`.

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

## Including Custom Control Types

The ToolBar component provides generic [control types](https://www.telerik.com/kendo-angular-ui/components/toolbar/toolbar/control-types) that can be added to the TreeList's toolbar, alongside the built-in toolbar directives of the TreeList. The ToolBar component also allows you to include [custom control types](https://www.telerik.com/kendo-angular-ui/components/toolbar/toolbar/custom-control-types) in the TreeList's toolbar such as dropdowns, inputs, and others.

The following example demonstrates how to include custom control types in the TreeList's toolbar, different from the built-in toolbar directives.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/treelist/toolbar/toolbar-tools/basic-example/source.txt)

## Suggested Links

* [TreeList Overview](https://www.telerik.com/kendo-angular-ui/components/treelist)
* [ToolBar Overview](https://www.telerik.com/kendo-angular-ui/components/toolbar/toolbar)
* [Toolbar Template](https://www.telerik.com/kendo-angular-ui/components/treelist/toolbar/toolbar-template)
* [API Reference of the TreeList](https://www.telerik.com/kendo-angular-ui/components/treelist/api/treelistcomponent)
* [API Reference of the ToolBarComponent](https://www.telerik.com/kendo-angular-ui/components/toolbar/api/toolbarcomponent)
