# OnToolbarGUI

> This function displays the search field with a toolbar style in the given Rect.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.IMGUI.Controls](/engine/6000.6/script-reference/unityeditor/imgui/controls.md)
* **Assembly:** UnityEditor.CoreModule

## OnToolbarGUI(Rect, string)

This function displays the search field with a toolbar style in the given Rect.

```csharp
public string OnToolbarGUI(Rect rect, string text)
```

### Parameters

**** (\[Rect]\(/engine/6000.6/script-reference/unityengine/rect)): Rectangle to use for the search field.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Text string to display in the search field.

### Returns

| Type                                                           | Description                                                                                                                   |
| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | The text entered in the search field. The original input string is returned instead if the search field text was not changed. |

## OnToolbarGUI(string, GUILayoutOption\[])

This function displays the search field with the toolbar UI style and uses the GUILayout class to automatically calculate the position and size of the Rect it is rendered to. Pass an optional list to specify extra layout properties.

```csharp
public string OnToolbarGUI(string text, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Text string to display in the search field.**** (\[GUILayoutOption\[]]\(/engine/6000.6/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. \
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.6/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.6/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.6/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.6/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.6/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.6/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.6/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.6/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                           | Description                                                                                                                   |
| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | The text entered in the search field. The original input string is returned instead if the search field text was not changed. |
