# DropDown

> Displays the menu at the specified position.

## Definition

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

## DropDown(Rect)

Displays the menu at the specified position.

> **Warning:**
>
> **Deprecated.** This version of Dropdown is deprecated. To ensure the dropdown is positioned correctly, please provide a reference to the targetElement.

```csharp
public void DropDown(Rect position)
```

### Parameters

**** (\[Rect]\(/engine/6000.6/script-reference/unityengine/rect)): The position in the coordinate space of the panel.

### Remarks

The parent element that displays the menu:

* For Editor UI, the parent element is [EditorWindow.rootVisualElement](/engine/6000.6/script-reference/unityeditor/editorwindow/rootvisualelement.md).

* For runtime UI, the parent element is [\_rootVisualElement](/engine/6000.6/script-reference/unityengine/uielements/uidocument/rootvisualelement.md).

The `dropdownMenuSizeMode` parameter determines the width of the menu.

## DropDown(Rect, VisualElement, bool)

Displays the menu at the specified position.

> **Warning:**
>
> **Deprecated.** This version of Dropdown is deprecated. Please use DropDown(Rect position, VisualElement targetElement, DropdownMenuSizeMode dropdownMenuSizeMode).

```csharp
public void DropDown(Rect position, VisualElement targetElement, bool anchored = false)
```

### Parameters

**** (\[Rect]\(/engine/6000.6/script-reference/unityengine/rect)): The position in the coordinate space of the panel.**** (\[VisualElement]\(/engine/6000.6/script-reference/unityengine/uielements/visualelement)): The element determines which root to use as the menu's parent.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)):&#x20;

### Remarks

The parent element that displays the menu:

* For Editor UI, the parent element is [EditorWindow.rootVisualElement](/engine/6000.6/script-reference/unityeditor/editorwindow/rootvisualelement.md).

* For runtime UI, the parent element is [\_rootVisualElement](/engine/6000.6/script-reference/unityengine/uielements/uidocument/rootvisualelement.md).

The `dropdownMenuSizeMode` parameter determines the width of the menu.

## DropDown(Rect, VisualElement, bool, bool)

Displays the menu at the specified position.

> **Warning:**
>
> **Deprecated.** This version of Dropdown is deprecated. Please use DropDown(Rect position, VisualElement targetElement, DropdownMenuSizeMode dropdownMenuSizeMode).

```csharp
public void DropDown(Rect position, VisualElement targetElement, bool anchored = false, bool fitContentWidthIfAnchored = false)
```

### Parameters

**** (\[Rect]\(/engine/6000.6/script-reference/unityengine/rect)): The position in the coordinate space of the panel.**** (\[VisualElement]\(/engine/6000.6/script-reference/unityengine/uielements/visualelement)): The element determines which root to use as the menu's parent.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): **** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)):&#x20;

### Remarks

The parent element that displays the menu:

* For Editor UI, the parent element is [EditorWindow.rootVisualElement](/engine/6000.6/script-reference/unityeditor/editorwindow/rootvisualelement.md).

* For runtime UI, the parent element is [\_rootVisualElement](/engine/6000.6/script-reference/unityengine/uielements/uidocument/rootvisualelement.md).

The `dropdownMenuSizeMode` parameter determines the width of the menu.

## DropDown(Rect, VisualElement, DropdownMenuSizeMode)

Displays the menu at the specified position.

```csharp
public override void DropDown(Rect position, VisualElement targetElement, DropdownMenuSizeMode dropdownMenuSizeMode = DropdownMenuSizeMode.Auto)
```

### Parameters

**** (\[Rect]\(/engine/6000.6/script-reference/unityengine/rect)): The position in the coordinate space of the panel.**** (\[VisualElement]\(/engine/6000.6/script-reference/unityengine/uielements/visualelement)): The element determines which root to use as the menu's parent.**** (\[DropdownMenuSizeMode]\(/engine/6000.6/script-reference/unityengine/uielements/dropdownmenusizemode)): Indicates how to format the menu. Refer to [DropdownMenuSizeMode](/engine/6000.6/script-reference/unityengine/uielements/dropdownmenusizemode.md) for more information. Defaults to Auto.

### Remarks

The parent element that displays the menu:

* For Editor UI, the parent element is [EditorWindow.rootVisualElement](/engine/6000.6/script-reference/unityeditor/editorwindow/rootvisualelement.md).

* For runtime UI, the parent element is [\_rootVisualElement](/engine/6000.6/script-reference/unityengine/uielements/uidocument/rootvisualelement.md).

The `dropdownMenuSizeMode` parameter determines the width of the menu.
