# CollapseItem(int, bool, bool)

> Collapses the item with the specified ID, hiding its children. Allows to collapse the whole hierarchy under that item.

## Definition

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

```csharp
public void CollapseItem(int id, bool collapseAllChildren, bool refresh = true)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The item ID.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether the whole hierarchy under that item will be collapsed.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to refresh items or not. Set to false when doing multiple operations on the tree, to only do one RefreshItems once all operations are done.
