---
title: "listRowInsets(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/listrowinsets(_:)"
---

# listRowInsets(_:)

Applies an inset to the rows in a list.

## Declaration

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

```

## Parameters

- `insets`: The doc://com.apple.SwiftUI/documentation/SwiftUI/EdgeInsets to apply to the edges of the view.

## Return Value

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

## Discussion

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

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.

## See Also

### Configuring a list’s layout

- [listRowInsets(_:_:)](swiftui/view/listrowinsets(_:_:).md)
- [defaultMinListRowHeight](swiftui/environmentvalues/defaultminlistrowheight.md)
- [defaultMinListHeaderHeight](swiftui/environmentvalues/defaultminlistheaderheight.md)
- [listRowSpacing(_:)](swiftui/view/listrowspacing(_:).md)
- [listSectionSpacing(_:)](swiftui/view/listsectionspacing(_:).md)
- [ListSectionSpacing](swiftui/listsectionspacing.md)
- [listSectionMargins(_:_:)](swiftui/view/listsectionmargins(_:_:).md)
