# clicked

> Callback triggered when the target element is clicked.

## Definition

* **Type:** Event
* **Namespace:** [UnityEngine.UIElements](/engine/6000.5/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

```csharp
public event Action clicked
```

### Remarks

The `clicked` and `clickedWithEventInfo` events are invoked when any of the following conditions occur:

* The target receives a [NavigationSubmitEvent](/engine/6000.5/script-reference/unityengine/uielements/navigationsubmitevent.md).

* The target receives a [PointerDownEvent](/engine/6000.5/script-reference/unityengine/uielements/pointerdownevent.md) followed by a [PointerUpEvent](/engine/6000.5/script-reference/unityengine/uielements/pointerupevent.md).

If the `delay` and `interval` optional constructor parameters are used, then the `clicked` event is considered repeatable and is instead invoked when any of the following conditions occur:

* The target receives a [NavigationSubmitEvent](/engine/6000.5/script-reference/unityengine/uielements/navigationsubmitevent.md).

* The target just received a [PointerDownEvent](/engine/6000.5/script-reference/unityengine/uielements/pointerdownevent.md).

* The target has received a [PointerDownEvent](/engine/6000.5/script-reference/unityengine/uielements/pointerdownevent.md) and the pointer button has been held down for a given period of time.

If the `clicked` event is repeatable, then the first repeated click occurs after an amount of time corresponding to the `delay` parameter, and subsequent clicks occur after amounts of time corresponding to the `interval` parameter.

The callback methods registered to this event should have no parameters and return no value.

This manipulator makes use of pointer capture.

Additional Resources: [\_clickedWithEventInfo](/engine/6000.5/script-reference/unityengine/uielements/clickable/clickedwitheventinfo.md), [NavigationSubmitEvent](/engine/6000.5/script-reference/unityengine/uielements/navigationsubmitevent.md), [PointerDownEvent](/engine/6000.5/script-reference/unityengine/uielements/pointerdownevent.md), [PointerCaptureEvent](/engine/6000.5/script-reference/unityengine/uielements/pointercaptureevent.md)

### Examples

```csharp
using UnityEngine;
using UnityEditor;
using UnityEngine.UIElements;

public class ButtonExample : EditorWindow
{
    [MenuItem("Window/Button Example")]
    public static void ShowExample()
    {
        GetWindow<ButtonExample>();
    }

    void CreateGUI()
    {
        var button = new Button { text = "Click me" };
        button.clicked += OnClick;

        rootVisualElement.Add(button);
    }

    void OnClick()
    {
        Debug.Log("Clicked!");
    }
}
```
