---
title: "Custom annotation tool creation in MAUI viewer"
canonical_url: "https://www.nutrient.io/guides/maui/user-interface/annotation-toolbar/create-a-new-tool/"
md_url: "https://www.nutrient.io/guides/maui/user-interface/annotation-toolbar/create-a-new-tool.md"
last_updated: "2026-05-23T00:08:18.135Z"
description: "Learn to create and customize annotation tools in the MAUI PDF viewer with easy steps and flexible toolbar layouts."
---

# Create custom annotation tools in MAUI PDF viewer

The main differentiator between built-in toolbar items and user-defined ones is the `Id`, which is used to explicitly identify the latter. You can add one of the built-in types or a custom toolbar item of [`CustomAnnotationToolbarItem`](https://www.nutrient.io/api/maui/sdk/PSPDFKit.Sdk.Models.Toolbar.AnnotationToolbarItems.CustomAnnotationToolbarItem.html) type to the annotation toolbar. All these types are subclasses of [`AnnotationToolbarItems`](https://www.nutrient.io/api/maui/sdk/PSPDFKit.Sdk.Models.Toolbar.AnnotationToolbarItems.html):

```csharp

using static PSPDFKit.Sdk.Models.Toolbar.AnnotationToolbarItems;...

var toolbarItem = new CustomAnnotationToolbarItem("customItemId")
{
  Icon = "newIcon.svg",
  Tooltip = "My button"
};
toolbarItem.Clicked +=
(s, e) => Debug.WriteLine("My toolbar item clicked");

```

When the `Icon` for a button is missing, the `Tooltip` will instead be displayed as `Button.Text`. This is useful if you want to create text-only buttons.

A `Clicked` event is invoked when a button is either clicked or tapped (on touch devices).

Once the custom button is ready, it’s possible to insert it into the current list of any annotation type:

```csharp

PSPDFKitController.AnnotationToolbar.ToolbarItems[AnnotationType.Ink].Add(toolbarItem);

```

## Toolbar layout and the spacer item

The items list is rendered as a flat list of sibling elements that are separated by a special toolbar item called `SpacerAnnotationToolbarItem`. This solution makes the toolbar layout flexible and easy to customize.

`SpacerAnnotationToolbarItem` is an empty element, and it pushes items from both sides together, making them more compact. You can insert as many spacer items as you want.
---

## Related pages

- [Rearranging annotation tools in our viewer toolbar](/guides/maui/user-interface/annotation-toolbar/rearrange.md)
- [Customizing an existing annotation tool in our viewer toolbar](/guides/maui/user-interface/annotation-toolbar/customize-existing-tools.md)
- [Removing an annotation tool from our viewer toolbar](/guides/maui/user-interface/annotation-toolbar/remove-a-tool.md)

