---
title: "toggleSectionCollapse(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionview/togglesectioncollapse(_:)"
---

# toggleSectionCollapse(_:)

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

## Declaration

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

## Parameters

- `sender`: The object that requested the action.

## Discussion

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.

## See Also

### Inserting, Moving, Deleting, and Collapsing Sections

- [insertSections(_:)](appkit/nscollectionview/insertsections(_:).md)
- [moveSection(_:toSection:)](appkit/nscollectionview/movesection(_:tosection:).md)
- [deleteSections(_:)](appkit/nscollectionview/deletesections(_:).md)
