<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.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:7SwiftUI4ViewPAAE13listRowInsetsyQrAA04EdgeF0VSgF"
  },
  "title" : "listRowInsets(_:)"
}
-->

# listRowInsets(_:)

Applies an inset to the rows in a list.

```
nonisolated func listRowInsets(_ insets: EdgeInsets?) -> some View
```

## Parameters

`insets`

The [`EdgeInsets`](/documentation/SwiftUI/EdgeInsets) to apply to the edges of the
view.

## Return Value

A view that uses the given edge insets when used as a list
cell.

## Discussion

Use `listRowInsets(_:)` to change the default padding of the content of
list items.

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 edge insets of each row
of the list according to the [`EdgeInsets`](/documentation/SwiftUI/EdgeInsets) provided:

```
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(.init(top: 0,
                                         leading: 25,
                                         bottom: 0,
                                         trailing: 0))
            }
        }
    }
}
```

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

> 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)