<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionLayoutListConfiguration-swift.struct/contentHuggingElements-swift.property",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit35UICollectionLayoutListConfigurationV22contentHuggingElementsAC07ContentgH0Vvp"
  },
  "title" : "contentHuggingElements"
}
-->

# contentHuggingElements

A setting that determines which type of items tightly hug their content.

```
var contentHuggingElements: UICollectionLayoutListConfiguration.ContentHuggingElements { get set }
```

## Discussion

The default value of this property is [`supplementaryHeader`](/documentation/UIKit/UICollectionLayoutListConfiguration-swift.struct/ContentHuggingElements-swift.struct/supplementaryHeader) in visionOS, and `[]` on all other platforms.

When the value of this property is [`supplementaryHeader`](/documentation/UIKit/UICollectionLayoutListConfiguration-swift.struct/ContentHuggingElements-swift.struct/supplementaryHeader), header views tightly hug their content. This means header views don’t stretch to fill the width of the collection view if its content’s intrinsic content size is less than the collection view’s width.

---

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)