# MainToolbarLabel

> A label element for the main toolbar.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor.Toolbars](/engine/6000.7/script-reference/unityeditor/toolbars.md)
* **Assembly:** UnityEditor
* **Inherits from:** [MainToolbarElement](/engine/6000.7/script-reference/unityeditor/toolbars/maintoolbarelement.md)

```csharp
[Icon("UIToolkit/Icons/Label.png")]
public sealed class MainToolbarLabel : MainToolbarElement
```

## Remarks

To add a label element in the main toolbar, use a static method registered with [MainToolbarElementAttribute](/engine/6000.7/script-reference/unityeditor/toolbars/maintoolbarelementattribute.md) to return this class. To construct the content of the label, use [MainToolbarContent](/engine/6000.7/script-reference/unityeditor/toolbars/maintoolbarcontent.md).

## Examples

```csharp
using UnityEditor;
using UnityEditor.Toolbars;
using UnityEngine;

public class MainToolbarLabelExample
{
    [MainToolbarElement("Examples/Information Label", defaultDockPosition = MainToolbarDockPosition.Middle)]
    public static MainToolbarElement InformationLabel()
    {
        return new MainToolbarLabel(new MainToolbarContent("Information", EditorGUIUtility.FindTexture("Search Icon"), "This shows information" ));
    }
}
```

## Constructors

| Constructor                                                                                                                                | Description                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------- |
| [MainToolbarLabel(UnityEditor.Toolbars.MainToolbarContent)](/engine/6000.7/script-reference/unityeditor/toolbars/maintoolbarlabel/ctor.md) | Specifies the content of a main toolbar label. |

## Inheritance

**Inherited Members:**

* [MainToolbarElement.content](/engine/6000.7/script-reference/unityeditor/toolbars/maintoolbarelement/content.md)
* [MainToolbarElement.displayed](/engine/6000.7/script-reference/unityeditor/toolbars/maintoolbarelement/displayed.md)
* [MainToolbarElement.enabled](/engine/6000.7/script-reference/unityeditor/toolbars/maintoolbarelement/enabled.md)
* [MainToolbarElement.populateContextMenu](/engine/6000.7/script-reference/unityeditor/toolbars/maintoolbarelement/populatecontextmenu.md)
