# Configuring the ToolBar in the Angular Data Grid

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 Grid](https://www.telerik.com/kendo-angular-ui/components/grid) instead of the [toolbar template](https://www.telerik.com/kendo-angular-ui/components/grid/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 Grid's functionality.

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

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

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

## Built-In Grid Toolbar Tools

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

### Tools for Common Grid Functionalitites

<table>
  <thead>
    <tr>
      <th style="width: 25%">Toolbar Tool</th>
      <th style="width: 75%">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a href="/grid/api/smartboxtoolbartoolcomponent"><code>kendo-grid-smartbox-tool</code></a></td>
      <td>Component that provides the <a href="/grid/smart-grid/ai-toolbar-tool">AI Smart Box</a> with keyboard search, semantic search, and AI-powered interactions in a single toolbar control.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/aiassistanttoolbardirective"><code>kendoGridAIAssistantTool</code></a></td>
      <td>Directive that provides an <a href="/grid/smart-grid/ai-toolbar-assistant">AI Assistant</a> for performing data operations using natural language prompts.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/filtercommandtoolbardirective"><code>kendoGridFilterTool</code></a></td>
      <td>Directive for <a href="/grid/filtering/basics">filtering</a> the Grid component.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/sortcommandtoolbardirective"><code>kendoGridSortTool</code></a></td>
      <td>Directive for <a href="/grid/sorting/basics">sorting</a> the Grid component.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/groupcommandtoolbardirective"><code>kendoGridGroupTool</code></a></td>
      <td>Directive for <a href="/grid/grouping/basics">grouping</a> the Grid component.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/columnchoosertoolbardirective"><code>kendoGridColumnChooserTool</code></a></td>
      <td>Directive that represents the <a href="/grid/api/columnchoosercomponent">column chooser component</a> of the Grid.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/pdfcommandtoolbardirective"><code>kendoGridPDFTool</code></a></td>
      <td>Directive that triggers the Grid's <a href="/grid/export/pdf-export">PDF export</a> feature.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/excelcommandtoolbardirective"><code>kendoGridExcelTool</code></a></td>
      <td>Directive that triggers the Grid's <a href="/grid/export/excel-export">Excel export</a> feature.</td>
    </tr>
  </tbody>
</table>

### Tools for Grid Editing

<table>
  <thead>
    <tr>
      <th style="width: 25%">Toolbar Tool</th>
      <th style="width: 75%">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a href="/grid/api/addcommandtoolbardirective"><code>kendoGridAddTool</code></a></td>
      <td>Directive for adding a new item to the Grid. Triggers the Grid's <a href="/grid/api/gridcomponent#add"><code>add</code></a> event.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/editcommandtoolbardirective"><code>kendoGridEditTool</code></a></td>
      <td>Directive for editing an item. Triggers the Grid's <a href="/grid/api/gridcomponent#edit"><code>edit</code></a> event.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/removecommandtoolbardirective"><code>kendoGridRemoveTool</code></a></td>
      <td>Directive for removing a record. Triggers the Grid's <a href="/grid/api/gridcomponent#remove"><code>remove</code></a> event.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/savecommandtoolbardirective"><code>kendoGridSaveTool</code></a></td>
      <td>Directive for saving the changes. Triggers the Grid's <a href="/grid/api/gridcomponent#save"><code>save</code></a> event.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/cancelcommandtoolbardirective"><code>kendoGridCancelTool</code></a></td>
      <td>Directive for canceling the changes. Triggers the Grid's <a href="/grid/api/gridcomponent#cancel"><code>cancel</code></a> event.</td>
    </tr>
  </tbody>
</table>

### Tools for Grid State Management

<table>
  <thead>
    <tr>
      <th style="width: 25%">Toolbar Tool</th>
      <th style="width: 75%">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a href="/grid/api/undocommandtoolbardirective"><code>kendoGridUndoTool</code></a></td>
      <td>Directive for triggering the <code>undo</code> action in the Grid.</td>
    </tr>
    <tr>
      <td><a href="/grid/api/redocommandtoolbardirective"><code>kendoGridRedoTool</code></a></td>
      <td>Directive for triggering the <code>redo</code> action in the Grid.</td>
    </tr>
  </tbody>
</table>

## Including the Built-In Toolbar Tools

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

```html
<kendo-grid>
    <kendo-toolbar>
        <kendo-toolbar-button kendoGridAddTool></kendo-toolbar-button>
        <kendo-toolbar-button kendoGridEditTool></kendo-toolbar-button>
        <kendo-toolbar-button kendoGridSaveTool></kendo-toolbar-button>
        <kendo-toolbar-separator></kendo-toolbar-separator>
        <kendo-toolbar-spacer></kendo-toolbar-spacer>
        <kendo-toolbar-button kendoGridPDFTool></kendo-toolbar-button>
        ...
    </kendo-toolbar>
</kendo-grid>
```

## Customizing the Toolbar Tools Rendering

You can control the visibility of the text and icons for the tools displayed in the Grid's toolbar or in its overflow popup. To customize the appearance of the text or icon for 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 also have the ability to 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 itself to customize the appearance of the text and icons in 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-grid>
    <kendo-toolbar [showText]="showText" [showIcon]="showIcon">
        ...
    </kendo-toolbar>
</kendo-grid>
```

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

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

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

## Toggling the Visibility of Inactive Toolbar Tools

By default, the toolbar tools that are currently inactive are not displayed in the Grid's toolbar. For example:

* The `kendoGridEditTool` and `kendoGridRemoveTool` are initally hidden from the ToolBar and will appear when the user selects a row in the Grid.
* The `kendoGridEditTool` and `kendoGridRemoveTool` will hide from the ToolBar when the Grid enters edit mode.
* The `kendoGridSaveTool` and `kendoGridCancelTool` are initally hidden from the ToolBar and will only appear once the Grid enters edit mode.

To customize the default behavior and show the currently inactive tools in the Grid's toolbar at all times, you can use the [`showInactiveTools`](https://www.telerik.com/kendo-angular-ui/components/grid/api/gridcomponent#showinactivetools) property of the Grid. By setting this property to `true`, the inactive tools will be always displayed in the Grid's toolbar, but in a disabled state.

```html
<kendo-grid ... [showInactiveTools]="true">
    <kendo-toolbar>
        <kendo-toolbar-button kendoGridEditTool></kendo-toolbar-button>
        <kendo-toolbar-button kendoGridRemoveTool></kendo-toolbar-button>
        ...
    </kendo-toolbar>
</kendo-grid>
```

The following example demonstrates how to display the currently inactive tools in the Grid's toolbar by using the `showInactiveTools` property.

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

## Implementing a Responsive ToolBar in Grid

The Grid'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 Grid's toolbar when the overflow mode is set to `section`.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/grid/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 Grid's toolbar, alongside the built-in toolbar directives of the Grid. 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 Grid's toolbar such as dropdowns, inputs, and others.

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

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

## Known Limitations

* When [`menu`](https://www.telerik.com/kendo-angular-ui/components/grid/toolbar/grid-toolbar/\(slug://responsive_toolbar#menu-mode\)) overflow mode is set for the Grid's toolbar, the [`kendoGridFilterTool`](https://www.telerik.com/kendo-angular-ui/components/grid/api/filtercommandtoolbardirective), [`kendoGridSortTool`](https://www.telerik.com/kendo-angular-ui/components/grid/api/sortcommandtoolbardirective) and [`kendoGridColumnChooserTool`](https://www.telerik.com/kendo-angular-ui/components/grid/api/columnchoosertoolbardirective) are not supported as a part of the popup list when they overflow the component's width.

## Suggested Links

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