---
title: "expandItem(_:expandChildren:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsoutlineview/expanditem(_:expandchildren:)"
---

# expandItem(_:expandChildren:)

Expands a specified item and, optionally, its children.

## Declaration

```swift
func expandItem(_ item: Any?, expandChildren: Bool)
```

## Parameters

- `item`: An item in the receiver. Starting in OS X version 10.5, passing 'nil' will expand each item under the root in the outline view.
- `expandChildren`: If doc://com.apple.documentation/documentation/Swift/true, recursively expands item and its children. If doc://com.apple.documentation/documentation/Swift/false, expands item only (identical to doc://com.apple.appkit/documentation/AppKit/NSOutlineView/expandItem(_:)).

## Discussion

Discussion For example, this method is invoked with the expandChildren parameter set to true when a user Option-clicks the disclosure triangle for an item in the outline view (to expand the item and all its contained items). For each item expanded, posts an item expanded notification.

## See Also

### Expanding and Collapsing the Outline

- [expandItem(_:)](appkit/nsoutlineview/expanditem(_:).md)
- [collapseItem(_:)](appkit/nsoutlineview/collapseitem(_:).md)
- [collapseItem(_:collapseChildren:)](appkit/nsoutlineview/collapseitem(_:collapsechildren:).md)
