# ToggleLeft

> Make a toggle field where the toggle is to the left and the label immediately to the right of it.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.0/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

## ToggleLeft(string, bool, GUILayoutOption\[])

Make a toggle field where the toggle is to the left and the label immediately to the right of it.

```csharp
public static bool ToggleLeft(string label, bool value, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Label to display next to the toggle.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): The value to edit.**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

[EditorGUILayout.ToggleLeft](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggleleft.md) is similar to [GUILayout.Toggle](/engine/6000.0/script-reference/unityengine/guilayout/toggle.md) but respects the [EditorGUI.showMixedValue](/engine/6000.0/script-reference/unityeditor/editorgui/showmixedvalue.md) property and handles keyboard focus consistent with other Editor controls.  [EditorGUILayout.ToggleLeft](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggleleft.md) has the label close and to the left of the toggle.  (The [EditorGUILayout.Toggle](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggle.md) has the opposite with the label at a distance from the toggle and to the right.)

![EditorGUILayoutToggleLeft (ToggleLeft)](/api/media?file=/engine/6000.0/media/images/EditorGUILayoutToggleLeft.png)

*Show a button if the toggle control is selected.*

### Examples

```csharp
// Creates a new menu in the Editor called "Examples" with a new menu item called "ToggleLeft example"

using UnityEngine;
using UnityEditor;

public class Example : EditorWindow
{
    bool showBtn = true;

    [MenuItem("Examples/ToggleLeft example")]
    static void Init()
    {
        Example window = (Example)EditorWindow.GetWindow(typeof(Example), true, "ToggleLeft example");
        window.Show();
    }

    void OnGUI()
    {
        showBtn = EditorGUILayout.ToggleLeft("Show Button", showBtn);
        if (showBtn)
        {
            if (GUILayout.Button("Close"))
            {
                this.Close();
            }
        }
    }
}
```

## ToggleLeft(GUIContent, bool, GUILayoutOption\[])

Make a toggle field where the toggle is to the left and the label immediately to the right of it.

```csharp
public static bool ToggleLeft(GUIContent label, bool value, params GUILayoutOption[] options)
```

### Parameters

**** (\[GUIContent]\(/engine/6000.0/script-reference/unityengine/guicontent)): Label to display next to the toggle.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): The value to edit.**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

[EditorGUILayout.ToggleLeft](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggleleft.md) is similar to [GUILayout.Toggle](/engine/6000.0/script-reference/unityengine/guilayout/toggle.md) but respects the [EditorGUI.showMixedValue](/engine/6000.0/script-reference/unityeditor/editorgui/showmixedvalue.md) property and handles keyboard focus consistent with other Editor controls.  [EditorGUILayout.ToggleLeft](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggleleft.md) has the label close and to the left of the toggle.  (The [EditorGUILayout.Toggle](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggle.md) has the opposite with the label at a distance from the toggle and to the right.)

![EditorGUILayoutToggleLeft (ToggleLeft)](/api/media?file=/engine/6000.0/media/images/EditorGUILayoutToggleLeft.png)

*Show a button if the toggle control is selected.*

### Examples

```csharp
// Creates a new menu in the Editor called "Examples" with a new menu item called "ToggleLeft example"

using UnityEngine;
using UnityEditor;

public class Example : EditorWindow
{
    bool showBtn = true;

    [MenuItem("Examples/ToggleLeft example")]
    static void Init()
    {
        Example window = (Example)EditorWindow.GetWindow(typeof(Example), true, "ToggleLeft example");
        window.Show();
    }

    void OnGUI()
    {
        showBtn = EditorGUILayout.ToggleLeft("Show Button", showBtn);
        if (showBtn)
        {
            if (GUILayout.Button("Close"))
            {
                this.Close();
            }
        }
    }
}
```

## ToggleLeft(string, bool, GUIStyle, GUILayoutOption\[])

Make a toggle field where the toggle is to the left and the label immediately to the right of it.

```csharp
public static bool ToggleLeft(string label, bool value, GUIStyle labelStyle, params GUILayoutOption[] options)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Label to display next to the toggle.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): The value to edit.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md) to use for the label.**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

[EditorGUILayout.ToggleLeft](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggleleft.md) is similar to [GUILayout.Toggle](/engine/6000.0/script-reference/unityengine/guilayout/toggle.md) but respects the [EditorGUI.showMixedValue](/engine/6000.0/script-reference/unityeditor/editorgui/showmixedvalue.md) property and handles keyboard focus consistent with other Editor controls.  [EditorGUILayout.ToggleLeft](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggleleft.md) has the label close and to the left of the toggle.  (The [EditorGUILayout.Toggle](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggle.md) has the opposite with the label at a distance from the toggle and to the right.)

![EditorGUILayoutToggleLeft (ToggleLeft)](/api/media?file=/engine/6000.0/media/images/EditorGUILayoutToggleLeft.png)

*Show a button if the toggle control is selected.*

### Examples

```csharp
// Creates a new menu in the Editor called "Examples" with a new menu item called "ToggleLeft example"

using UnityEngine;
using UnityEditor;

public class Example : EditorWindow
{
    bool showBtn = true;

    [MenuItem("Examples/ToggleLeft example")]
    static void Init()
    {
        Example window = (Example)EditorWindow.GetWindow(typeof(Example), true, "ToggleLeft example");
        window.Show();
    }

    void OnGUI()
    {
        showBtn = EditorGUILayout.ToggleLeft("Show Button", showBtn);
        if (showBtn)
        {
            if (GUILayout.Button("Close"))
            {
                this.Close();
            }
        }
    }
}
```

## ToggleLeft(GUIContent, bool, GUIStyle, GUILayoutOption\[])

Make a toggle field where the toggle is to the left and the label immediately to the right of it.

```csharp
public static bool ToggleLeft(GUIContent label, bool value, GUIStyle labelStyle, params GUILayoutOption[] options)
```

### Parameters

**** (\[GUIContent]\(/engine/6000.0/script-reference/unityengine/guicontent)): Label to display next to the toggle.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): The value to edit.**** (\[GUIStyle]\(/engine/6000.0/script-reference/unityengine/guistyle)): Optional [GUIStyle](/engine/6000.0/script-reference/unityengine/guistyle.md) to use for the label.**** (\[GUILayoutOption\[]]\(/engine/6000.0/script-reference/unityengine/guilayoutoption)): An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style.\
&#x20;Additional Resources: [GUILayout.Width](/engine/6000.0/script-reference/unityengine/guilayout/width.md), [GUILayout.Height](/engine/6000.0/script-reference/unityengine/guilayout/height.md), [GUILayout.MinWidth](/engine/6000.0/script-reference/unityengine/guilayout/minwidth.md), [GUILayout.MaxWidth](/engine/6000.0/script-reference/unityengine/guilayout/maxwidth.md), [GUILayout.MinHeight](/engine/6000.0/script-reference/unityengine/guilayout/minheight.md), [GUILayout.MaxHeight](/engine/6000.0/script-reference/unityengine/guilayout/maxheight.md), [GUILayout.ExpandWidth](/engine/6000.0/script-reference/unityengine/guilayout/expandwidth.md), [GUILayout.ExpandHeight](/engine/6000.0/script-reference/unityengine/guilayout/expandheight.md).

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |

### Remarks

[EditorGUILayout.ToggleLeft](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggleleft.md) is similar to [GUILayout.Toggle](/engine/6000.0/script-reference/unityengine/guilayout/toggle.md) but respects the [EditorGUI.showMixedValue](/engine/6000.0/script-reference/unityeditor/editorgui/showmixedvalue.md) property and handles keyboard focus consistent with other Editor controls.  [EditorGUILayout.ToggleLeft](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggleleft.md) has the label close and to the left of the toggle.  (The [EditorGUILayout.Toggle](/engine/6000.0/script-reference/unityeditor/editorguilayout/toggle.md) has the opposite with the label at a distance from the toggle and to the right.)

![EditorGUILayoutToggleLeft (ToggleLeft)](/api/media?file=/engine/6000.0/media/images/EditorGUILayoutToggleLeft.png)

*Show a button if the toggle control is selected.*

### Examples

```csharp
// Creates a new menu in the Editor called "Examples" with a new menu item called "ToggleLeft example"

using UnityEngine;
using UnityEditor;

public class Example : EditorWindow
{
    bool showBtn = true;

    [MenuItem("Examples/ToggleLeft example")]
    static void Init()
    {
        Example window = (Example)EditorWindow.GetWindow(typeof(Example), true, "ToggleLeft example");
        window.Show();
    }

    void OnGUI()
    {
        showBtn = EditorGUILayout.ToggleLeft("Show Button", showBtn);
        if (showBtn)
        {
            if (GUILayout.Button("Close"))
            {
                this.Close();
            }
        }
    }
}
```
