<!--
{
  "availability" : [
    "macOS: 10.12.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionView/toggleSectionCollapse(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCollectionView(im)toggleSectionCollapse:"
  },
  "title" : "toggleSectionCollapse(_:)"
}
-->

# toggleSectionCollapse(_:)

Collapses the section in which the sender resides into a single horizontally scrollable row.

```
@IBAction func toggleSectionCollapse(_ sender: Any)
```

## Parameters

`sender`

The object that requested the action.

## Discussion

The icon view in Finder offers this type of collapsible section behavior when users choose the Show Less and Show More buttons. To enable this behavior, your header view must conform to the `NSCollectionViewSectionHeaderView` protocol, because the collection view uses the `sectionCollapseButton` property to identify the button that controls the collapse action.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)