Unity Editor Window Toolbar

How can i make a toggle button in an editor window toolbar like the “Clear on play” button of the console window. My code for the toolbar looks like this:


    GUILayout.BeginHorizontal(EditorStyles.toolbar);
    
    if (GUILayout.Button("Clear All", EditorStyles.toolbarButton)) {
    
    }
    		
    GUILayout.FlexibleSpace();
    		
    GUILayout.EndHorizontal();

Use GUILayout.Toggle. EditorGUILayout.Toggle, which seems like the more obvious choice, is difficult to style correctly.

bool someOption;

void OnGUI ()
{
    GUILayout.BeginHorizontal(EditorStyles.toolbar);
    someOption = GUILayout.Toggle(someOption, "Toggle Me", EditorStyles.toolbarButton);
    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();
}