<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionLayoutBoundarySupplementaryItem",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCollectionLayoutBoundarySupplementaryItem"
  },
  "title" : "NSCollectionLayoutBoundarySupplementaryItem"
}
-->

# NSCollectionLayoutBoundarySupplementaryItem

An object used to add headers or footers to a collection view.

```
class NSCollectionLayoutBoundarySupplementaryItem
```

## Overview

A boundary supplementary item is a specialized type of supplementary item ([`NSCollectionLayoutSupplementaryItem`](/documentation/AppKit/NSCollectionLayoutSupplementaryItem)). You use boundary supplementary items to add headers or footers to a section of a collection view or the entire collection view.

Each type of supplementary item must have a unique element kind. Consider tracking these strings together in a way that makes it straightforward to identify each element, for example:

```swift
struct ElementKind {
    static let badge = "badge-element-kind"
    static let background = "background-element-kind"
    static let sectionHeader = "section-header-element-kind"
    static let sectionFooter = "section-footer-element-kind"
    static let layoutHeader = "layout-header-element-kind"
    static let layoutFooter = "layout-footer-element-kind"
}
```

Add boundary supplementary items to a section by setting that section’s [`boundarySupplementaryItems`](/documentation/AppKit/NSCollectionViewCompositionalLayoutConfiguration/boundarySupplementaryItems) property:

```swift
let section = NSCollectionLayoutSection(group: group)

let headerFooterSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
                                             heightDimension: .estimated(44))
    
let sectionHeader = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerFooterSize,
                                                               elementKind: ElementKind.sectionHeader,
                                                                 alignment: .top)
let sectionFooter = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerFooterSize,
                                                               elementKind: ElementKind.sectionFooter,
                                                                 alignment: .bottom)
    
section.boundarySupplementaryItems = [sectionHeader, sectionFooter]
```

## Topics

### Creating a boundary supplementary item

[`+  boundarySupplementaryItemWithLayoutSize:elementKind:alignment:`](/documentation/AppKit/NSCollectionLayoutBoundarySupplementaryItem/init(layoutSize:elementKind:alignment:))

Creates a boundary supplementary item of the specified size and element kind, with an alignment relative to a section or layout.

[`+  boundarySupplementaryItemWithLayoutSize:elementKind:alignment:absoluteOffset:`](/documentation/AppKit/NSCollectionLayoutBoundarySupplementaryItem/init(layoutSize:elementKind:alignment:absoluteOffset:))

Creates a boundary supplementary item of the specified size and element kind, with an alignment relative to a section or layout at an absolute offset.

### Specifying scrolling behavior

[`pinToVisibleBounds`](/documentation/AppKit/NSCollectionLayoutBoundarySupplementaryItem/pinToVisibleBounds)

A Boolean value that indicates whether a header or footer is pinned to the top or bottom visible boundary of the section or layout it’s attached to.

### Specifying position

[`offset`](/documentation/AppKit/NSCollectionLayoutBoundarySupplementaryItem/offset)

The floating-point value of the boundary supplementary item’s offset from the section or layout it’s attached to.

[`alignment`](/documentation/AppKit/NSCollectionLayoutBoundarySupplementaryItem/alignment)

The alignment of the boundary supplementary item relative to the section or layout it’s attached to.

[`extendsBoundary`](/documentation/AppKit/NSCollectionLayoutBoundarySupplementaryItem/extendsBoundary)

A Boolean value that indicates whether a boundary supplementary item extends the content area of the section or layout it’s attached to.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`NSCollectionLayoutSupplementaryItem`](/documentation/AppKit/NSCollectionLayoutSupplementaryItem)

---

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)