# ToolbarItem

## Content

# Interface: ToolbarItem

Type representing a viewer's toolbar item.

## Example

```javascript
var pdfExportButton: ToolbarItem = {
    key: '$pdfExportButtonKey',
    checked: true,
    enabled: true,
    iconCssClass: 'mdi mdi-file-pdf',
    text: 'Export to PDF',
    title: 'Export to PDF',
    action: function(item) {
        console.log('Export to PDF function works here');
    },
    onUpdate: function(arg, item) {
        console.log('Something in viewer was updated, check/update button state here');
    }
};
viewer.toolbar.desktop.addItem(pdfExportButton);
```

## Properties

### action

```ts
action: () => void;
```

Action handler for the toolbar item.

#### Returns

`void`

***

### checked?

```ts
optional checked?: boolean;
```

Shows whether the toolbar item is checked.

***

### enabled?

```ts
optional enabled?: boolean;
```

Shows whether the toolbar item is enabled.

***

### iconCssClass?

```ts
optional iconCssClass?: string;
```

Specifies css class for the icon of the toolbar item.

***

### key

```ts
key: string;
```

The uniq identifier of the toolbar item.
See keys of the standard viewer's toolbar buttons here: [[ToolbarButtons]]

***

### onUpdate

```ts
onUpdate: () => ToolbarItem;
```

The function called to update toolbar item state.

#### Returns

`ToolbarItem`

***

### text?

```ts
optional text?: string;
```

Specifies the text of the toolbar item.

***

### title?

```ts
optional title?: string;
```

Specifies the tooltip of the toolbar item.
