# SetExpandedRecursive(int, bool)

> Expand or collapse all items under item with id.

## Definition

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

```csharp
public void SetExpandedRecursive(int id, bool expanded)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): TreeViewItem ID.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Expanded state: true expands, false collapses.

### Remarks

This is also used internally when Alt/Option + clicking an foldout arrow of an item to expand/collapse the entire sub-tree under this item.
