# Grid Toolbar

The [Blazor Grid](https://demos.telerik.com/blazor-ui/grid/overview) toolbar can render built-in and custom tools. This article describes the built-in tools and shows how to add [custom tools](https://www.telerik.com/blazor-ui/documentation/components/grid/toolbar#custom-tools) or create a [custom toolbar](https://www.telerik.com/blazor-ui/documentation/components/grid/toolbar#custom-toolbar-configuration).

## Built-In Tools

The [Blazor Grid](https://demos.telerik.com/blazor-ui/grid/overview) provides several built-in tools that can be added to the component toolbar. To include a specific tool in the [toolbar configuration](https://www.telerik.com/blazor-ui/documentation/components/grid/toolbar#toolbar-tools-configuration), use the respective tool tags below.

### Command Tools

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Tool Name    | Tool Tag                     | Description                                                                                                                                                                                                                                                                                                                                                                                       |
| ------------ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Add          | `GridToolBarAddTool`         | An `Add` command button that fires the [`OnAdd` event](https://www.telerik.com/blazor-ui/documentation/components/grid/editing/overview#events).                                                                                                                                                                                                                                                  |
| AI Assistant | `GridToolBarAIAssistantTool` | A tool that shows an [AI Prompt component](https://www.telerik.com/blazor-ui/documentation/components/aiprompt/overview) for AI-enabled data operations on the Grid data. See [Grid AI Features](https://www.telerik.com/blazor-ui/documentation/components/grid/smart-ai-features/overview) for details and examples.                                                                            |
| Cancel       | `GridToolBarCancelEditTool`  | A `Cancel` command button that applies to the row in edit mode and fires [`OnCancel`](https://www.telerik.com/blazor-ui/documentation/components/grid/editing/overview#events). [`Inline`](https://www.telerik.com/blazor-ui/documentation/components/grid/editing/inline) or [`Popup`](https://www.telerik.com/blazor-ui/documentation/components/grid/editing/popup) editing mode is required.  |
| CsvExport    | `GridToolBarCsvExportTool`   | A `CsvExport` command for CSV files that fires the [`OnBeforeExport` event](https://www.telerik.com/blazor-ui/documentation/components/grid/export/events#onbeforeexport).                                                                                                                                                                                                                        |
| Delete       | `GridToolBarDeleteTool`      | A `Delete` command for the selected row that fires [`OnDelete`](https://www.telerik.com/blazor-ui/documentation/components/grid/editing/overview#events). Row selection and editing are required.                                                                                                                                                                                                 |
| Edit         | `GridToolBarEditTool`        | An `Edit` command button for the selected row that fires [`OnEdit`](https://www.telerik.com/blazor-ui/documentation/components/grid/editing/overview#events). Row selection and `Inline` or `Popup` editing mode are required.                                                                                                                                                                    |
| ExcelExport  | `GridToolBarExcelExportTool` | An `ExcelExport` command for Excel files that fires the [`OnBeforeExport` event](https://www.telerik.com/blazor-ui/documentation/components/grid/export/events#onbeforeexport).                                                                                                                                                                                                                   |
| Filter       | `GridToolBarFilterTool`      | A toggle button that opens UI for filtering. On desktop screens, it displays a popup with a filter menu; on mobile devices, it renders an `ActionSheet`. The filter component has two views: one for selecting the column to filter, and another for applying the filter to the selected column. The tool also exposes an `Icon` parameter that allows you to override the default icon.          |
| Group        | `GridToolBarGroupTool`       | A toggle button that opens a list of the groupable columns. Click a column to group by it. On mobile devices, the popup renders as an `ActionSheet`. The tool also exposes an `Icon` parameter that allows you to override the default icon.                                                                                                                                                      |
| Save         | `GridToolBarSaveEditTool`    | A `Save` command button for the row in edit mode that fires [`OnUpdate` or `OnCreate`](https://www.telerik.com/blazor-ui/documentation/components/grid/editing/overview#events). [`Inline`](https://www.telerik.com/blazor-ui/documentation/components/grid/editing/inline) or [`Popup`](https://www.telerik.com/blazor-ui/documentation/components/grid/editing/popup) editing mode is required. |
| Select All   | `GridToolBarSelectAllTool`   | A checkbox that selects all rows, according to the [Grid Checkbox column](https://www.telerik.com/blazor-ui/documentation/components/grid/columns/checkbox) configuration.                                                                                                                                                                                                                        |
| Sort         | `GridToolBarSortTool`        | A toggle button that opens a list of the sortable columns. Click a column to sort by it. On mobile devices, the popup renders as an `ActionSheet`. The tool also exposes an `Icon` parameter that allows you to override the default icon.                                                                                                                                                        |
| SearchBox    | `GridToolBarSearchBoxTool`   | A [searchbox that filters multiple string columns](https://www.telerik.com/blazor-ui/documentation/components/grid/filter/searchbox) simultaneously.                                                                                                                                                                                                                                              |

The **Edit** command button is disabled if there is no [selected Grid row](https://www.telerik.com/blazor-ui/documentation/components/grid/selection/rows). The **Save** and **Cancel** buttons are disabled when there is no row in edit mode.

### Layout Tools

| Tool Name | Tool Tag                | Description                                                                                                                                                                                                                                                                                                 |
| --------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Spacer    | `GridToolBarSpacerTool` | Consumes the available empty space and pushes the rest of the tools next to one another. When using a [`GridToolBarTemplate`](https://www.telerik.com/blazor-ui/documentation/components/grid/toolbar#custom-toolbar-configuration), you can mimic this tool with `<span class="k-toolbar-spacer"></span>`. |

## Custom Tools

In addition to the built-in tools, the Grid also supports custom tools. Use the `<GridToolBarCustomTool>` tag, which is a standard Blazor `RenderFragment`. See the example below.

## Toolbar Tools Configuration

Add a `<GridToolBar>` tag inside `<TelerikGrid>` to configure a toolbar, for example:

* Arrange the Grid tools in a specific order;
* Remove some of the built-in tools;
* Add custom tools.

> important `<GridToolBar>` and `<GridToolBarTemplate>` cannot be used together in the same Grid instance.

> caption Grid Toolbar Tools

<demo metaUrl="client/grid/toolbar-tools/" height="650"></demo>

## Adaptive Behavior

The Grid Toolbar can show its tools in a dropdown if the available horizontal space is limited. The following requirements apply:

* The Grid must use a `<GridToolBar>` tag. [Custom toolbar configurations](https://www.telerik.com/blazor-ui/documentation/components/grid/toolbar#custom-toolbar-configuration) with `<GridToolBarTemplate>` do not support built-in adaptive behaviors.
* The Grid must use [built-in](https://www.telerik.com/blazor-ui/documentation/components/grid/toolbar#built-in-tools) ToolBar tools. [Custom tools](https://www.telerik.com/blazor-ui/documentation/components/grid/toolbar#custom-tools) do not support built-in adaptive behaviors and may disappear if there is not enough space.

See [ToolBar Tools Configuration](https://www.telerik.com/blazor-ui/documentation/components/grid/toolbar#toolbar-tools-configuration) for an example.

## Custom Toolbar Configuration

Add a `<GridToolBarTemplate>` tag inside `<TelerikGrid>` to configure a custom toolbar. You can add your own HTML and components to create a more complex layout in the Grid header to match your business needs and also `GridCommandButton` instances (read more about the features available in those buttons in the [Command Column](https://www.telerik.com/blazor-ui/documentation/components/grid/columns/command) article).

When using a `<GridToolBarTemplate>`, you need to use the `Tab` key to navigate between the focusable items. This is because the `<GridToolBarTemplate>` allows rendering of custom elements. On the other hand, the `<GridToolBar>` uses the [built-in keyboard navigation](https://www.telerik.com/blazor-ui/documentation/accessibility/overview#keyboard-navigation) through arrow keys.

> caption Custom Grid Toolbar

<demo metaUrl="client/grid/toolbar-custom/" height="650"></demo>

## Next Steps

* [Handle Grid events](https://www.telerik.com/blazor-ui/documentation/components/grid/events)

## See Also

* [Grid Live Demo](https://demos.telerik.com/blazor-ui/grid/overview)
* [Grid API](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikgrid-1)
