<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/listRowInsets(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE13listRowInsetsyQrAA4EdgeO3SetV_14CoreFoundation7CGFloatVSgtF"
  },
  "title" : "listRowInsets(_:_:)"
}
-->

# listRowInsets(_:_:)

Sets the insets of rows in a list on the specified edges.

```
nonisolated func listRowInsets(_ edges: Edge.Set = .all, _ length: CGFloat?) -> some View
```

## Parameters

`edges`

The edges to set the insets to.

`length`

An amount, given in points, to set the insets to on
the specified edges.

## Return Value

A view in which the margins of list sections are set to the
specified amount

## Discussion

Use this modifier to change the default insets of list rows on the
specified edges.

In the example below, the `Flavor` enumeration provides content for list
items. The SwiftUI [`ForEach`](/documentation/SwiftUI/ForEach) structure computes views for each element
of the `Flavor` enumeration and extracts the raw value of each of its
elements using the resulting text to create each list row item. The
`listRowInsets(_:_:)` modifier then changes the leading inset of each
row of the list and leaves the default insets on the other edges
untouched:

```
struct ContentView: View {
    enum Flavor: String, CaseIterable, Identifiable {
        var id: String { self.rawValue }
        case vanilla, chocolate, strawberry
    }

    var body: some View {
        List {
            ForEach(Flavor.allCases) {
                Text($0.rawValue)
                    .listRowInsets(.leading, 25)
            }
        }
    }
}
```

![A screenshot showing a list with leading 25 point inset on each](images/com.apple.SwiftUI/SwiftUI-View-ListRowInsets@2x.png)

When applying multiple `listRowInsets` modifiers, modifiers with the
same edges will override modifiers higher up in the view hierarchy.

> Note: On iOS 18 and earlier, and on visionOS 2 and earlier, the
> content of list rows can grow slightly into the row insets. The
> effective vertical insets can then be smaller than expected.

---

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)