# ListBox Toolbar

The ListBox toolbar can render built-in and custom tools. The built-in tools are buttons that reorder and remove items or transfer items from and to another ListBox component. This article describes the built-in tools and shows how to add custom tools or customize the toolbar.

## Built-in Tools

By default, the ListBox displays all its built-in tools in the order below. Use the respective tool tag if you need to define a tool explicitly in a [custom toolbar configuration](https://www.telerik.com/blazor-ui/documentation/components/listbox/toolbar#toolbar-configuration).

Each button becomes enabled when it can be used, for example, when the user selects items. Each built-in button fires an event and the app must implement the required data source operation.

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

| Tool Name         | Tool Tag                                | Event On Click                                                                                       | Description                                                                     |
| ----------------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| Move Up           | `<ListBoxToolBarMoveUpTool />`          | [`OnReorder`](https://www.telerik.com/blazor-ui/documentation/components/listbox/events#onreorder)   | Moves the selected item(s) down by one position.                                |
| Move Down         | `<ListBoxToolBarMoveDownTool />`        | [`OnReorder`](https://www.telerik.com/blazor-ui/documentation/components/listbox/events#onreorder)   | Moves the selected items up by one position.                                    |
| Transfer To       | `<ListBoxToolBarTransferToTool />`      | [`OnTransfer`](https://www.telerik.com/blazor-ui/documentation/components/listbox/events#ontransfer) | Moves the selected items to a connected ListBox component.                      |
| Transfer From     | `<ListBoxToolBarTransferFromTool />`    | [`OnTransfer`](https://www.telerik.com/blazor-ui/documentation/components/listbox/events#ontransfer) | Moves the selected items from a connected ListBox component to the current one. |
| Transfer All To   | `<ListBoxToolBarTransferAllToTool />`   | [`OnTransfer`](https://www.telerik.com/blazor-ui/documentation/components/listbox/events#ontransfer) | Moves all items to a connected ListBox component.                               |
| Transfer All From | `<ListBoxToolBarTransferAllFromTool />` | [`OnTransfer`](https://www.telerik.com/blazor-ui/documentation/components/listbox/events#ontransfer) | Moves all items from the connected ListBox component to the current one.        |
| Remove            | `<ListBoxToolBarRemoveTool />`          | [`OnRemove`](https://www.telerik.com/blazor-ui/documentation/components/listbox/events#onremove)     | Removes the selected item(s).                                                   |

The descriptions above mention the typical user operation that each button implies. However, the exact operation depends entirely on the business requirements and event handler implementation. For example:

* Clicking on the Remove button can apply custom disabled styling to an item, instead of removing it. The app may also prevent selection of this item through the [ListBox `SelectedItemsChanged` event](https://www.telerik.com/blazor-ui/documentation/components/listbox/events#selecteditemschanged).
* Transferred items can be copied to another ListBox component, rather than moved.
* Reordered non-adjacent items can be moved with or without the gap between them.

## Custom Tools

In addition to built-in tools, the ListBox also supports custom tools. Use the `<ListBoxToolBarCustomTool>` tag, which is a standard Blazor `RenderFragment`. See the example under [Toolbar Configuration](https://www.telerik.com/blazor-ui/documentation/components/listbox/toolbar#toolbar-configuration).

## Toolbar Configuration

The following example demonstrates how to:

* Define a custom ListBox toolbar configuration with the desired tools in a specific order.
* Mimic the default toolbar configuration, except for the custom tool.
* Enable or disable a custom toolbar button, depending on the current ListBox selection.

The example below omits all required event handlers for brevity. Consult the [ListBox Events article](https://www.telerik.com/blazor-ui/documentation/components/listbox/events) for more information and complete examples.

> caption Setting up the ListBox Toolbar

<demo metaUrl="client/listbox/toolbar/" height="700px"></demo>

> The `<ListBoxToolBar>` tag exposes `ChildContent` as a Blazor `RenderFragment`.

* If you add this tag just to toggle its `Visible` parameter at runtime, you must also define the toolbar buttons explicitly. Otherwise the `RenderFragment` will remain empty (but not `null`) and no buttons will show.
* `RenderFragment` allows any child content (yet), however, the ListBox expects only built-in or custom tools.

## Next Steps

* [Choose the ListBox selection mode](https://www.telerik.com/blazor-ui/documentation/components/listbox/selection)
* [Connect Multiple ListBoxes](https://www.telerik.com/blazor-ui/documentation/components/listbox/connect)
* [Enable ListBox drag-and-drop](https://www.telerik.com/blazor-ui/documentation/components/listbox/drag-drop)
* [Implement ListBox templates](https://www.telerik.com/blazor-ui/documentation/components/listbox/templates)
* [Handle ListBox events](https://www.telerik.com/blazor-ui/documentation/components/listbox/events)

## See Also

* [Live Demo: ListBox Toolbar](https://demos.telerik.com/blazor-ui/listbox/toolbar)
