<!--
{
  "availability" : [
    "iOS: 16.1.0 -",
    "iPadOS: 16.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WidgetKit",
  "identifier" : "/documentation/WidgetKit/DynamicIslandExpandedRegion/contentMargins(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WidgetKit"
    ],
    "preciseIdentifier" : "s:9WidgetKit27DynamicIslandExpandedRegionV14contentMarginsyACyxG7SwiftUI4EdgeO3SetV_SdtF"
  },
  "title" : "contentMargins(_:_:)"
}
-->

# contentMargins(_:_:)

Overrides default content margins for the provided edges in the Dynamic Island.

```
func contentMargins(_ edges: Edge.Set = .all, _ length: Double) -> DynamicIslandExpandedRegion<Content>
```

## Parameters

`edges`

The edges that use the custom content margins.

`length`

The length of the custom margin for the given `edges`.

## Return Value

The view for the Dynamic Island expanded region with the updated content margins.

## Discussion

If you repeatedly use the `contentMargins(_:_:)` modifier, the system uses the
innermost specified values. The following example results in a margin of 8 points for
the trailing, top, and bottom edges, and uses the default margin for the leading edge:

```swift
DynamicIslandContentRegion(.trailing) {
    ContainerRelativeShape()
    .aspectRatio(1, contentMode:.fit)
}.contentMargins([.trailing, .top, .bottom], 8)
```

Note that the system applies the provided custom content margins to content that’s adjacent to the
modified content margin edges.

---

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)