<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITableView/contentHuggingElements",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITableView(py)contentHuggingElements"
  },
  "title" : "contentHuggingElements"
}
-->

# contentHuggingElements

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

```
var contentHuggingElements: UITableViewContentHuggingElements { get set }
```

## Discussion

The default value of this property is [`sectionHeaders`](/documentation/UIKit/UITableViewContentHuggingElements/sectionHeaders) for plain-style table views in visionOS, and [`UITableViewContentHuggingElementsNone`](/documentation/UIKit/UITableViewContentHuggingElements/UITableViewContentHuggingElementsNone) on all other platforms.

When the value of this property is [`sectionHeaders`](/documentation/UIKit/UITableViewContentHuggingElements/sectionHeaders), header views tightly hug their content. This means header views don’t stretch to fill the width of the table view if its content’s intrinsic content size is less than the table 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)