# DropDown

> Displays the menu at the specified position.

## Definition

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

## DropDown(Rect, VisualElement, bool)

Displays the menu at the specified position.

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

### Parameters

**** (\[Rect]\(/engine/6000.0/script-reference/unityengine/rect)): The position in the coordinate space of the panel.**** (\[VisualElement]\(/engine/6000.0/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)): If true, the menu's width matches the width of the `position`; otherwise, the menu expands to the container's full width.

### Remarks

The parent element that displays the menu:

* For Editor UI, the parent element is [EditorWindow.rootVisualElement](/engine/6000.0/script-reference/unityeditor/editorwindow/rootvisualelement.md).
* For runtime UI, the parent element is [UIDocument.rootVisualElement](/engine/6000.0/script-reference/unityengine/uielements/uidocument/rootvisualelement.md).

The `anchored` parameter determines the width of the menu. Refer to [GenericDropdownMenu](/engine/6000.0/script-reference/unityengine/uielements/genericdropdownmenu.md) for example usages.

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

Displays the menu at the specified position.

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

### Parameters

**** (\[Rect]\(/engine/6000.0/script-reference/unityengine/rect)): The position in the coordinate space of the panel.**** (\[VisualElement]\(/engine/6000.0/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)): If true, the menu's width matches the width of the `position`; otherwise, the menu expands to the container's full width.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): If true and the menu is anchored, the menu's width matches its content's width; otherwise, the menu's width matches the width of the `position`. If the menu is unanchored, this parameter is ignored.

### Remarks

The parent element that displays the menu:

* For Editor UI, the parent element is [EditorWindow.rootVisualElement](/engine/6000.0/script-reference/unityeditor/editorwindow/rootvisualelement.md).
* For runtime UI, the parent element is [UIDocument.rootVisualElement](/engine/6000.0/script-reference/unityengine/uielements/uidocument/rootvisualelement.md).

The `anchored` and `fitContentWidthIfAnchored` parameters determine the width of the menu. Refer to [GenericDropdownMenu](/engine/6000.0/script-reference/unityengine/uielements/genericdropdownmenu.md) for example usages.
