Section Index Label and Visibility

Sets the label that is used in a section index to point to this section, typically only a single character long. Changes the visibility of the list section index.

Section Index Label and Visibility - iOS Light Mode Preview

Platform Compatibility

iOS 26.0+ iPadOS 26.0+ macOS 26.0+ watchOS 26.0+ tvOS 26.0+ visionOS 26.0+

Tags

SwiftUI Code

Docs
let items = ["Foo", "Bar"]

var body: some View {
  List(items, id: \.self) { item in
  Section(item) {
    ForEach(0 ..< 42) { number in
    Text(String(describing: number))
  }
}
.sectionIndexLabel(item)
}
.listSectionIndexVisibility(.visible)

}

Found an issue or have a suggestion?

Created: August 10, 2025Updated: August 10, 2025