Skip to content

Instantly share code, notes, and snippets.

@cchana
Last active February 15, 2024 12:43
Show Gist options
  • Select an option

  • Save cchana/237391b3fae189c08fb7a97630283645 to your computer and use it in GitHub Desktop.

Select an option

Save cchana/237391b3fae189c08fb7a97630283645 to your computer and use it in GitHub Desktop.
How to place a borderless item into a list, removing all padding and spacing around the internal elements. In this example, I there's a groupbox which takes up the entire space of the list row. Question asked and answered on Stack Overflow: https://stackoverflow.com/questions/77982484/how-to-combine-groupbox-or-disclosuregroup-with-a-list-in-a-s…
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationStack {
List {
Section {
GroupBox("Box Title") {
Text("Box Content")
}
}
.listRowInsets(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0))
}
}
.navigationTitle("Page title")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment