scrollContentBackground

Specifies the visibility of the background for scrollable views within this view.

View ModifieriOS 16.0+macOS 13.0+watchOS 9.0+scrollContentBackground(_:) in SwiftUI

Declaration

React
compose().scrollContentBackground(
  visibility: SwiftUI.Visibility
)
Swift
nonisolated func scrollContentBackground(
    _ visibility: Visibility
) -> some View

Parameters

Discussion

The following example hides the standard system background of the List.

List {
    Text("One")
    Text("Two")
    Text("Three")
}
.scrollContentBackground(.hidden)

On macOS 15.0 and later, the visibility of the scroll background helps achieve the seamless window/titlebar appearance for scroll views that fill the window's content view, or a pane's full width and height. List and Form have the seamless appearance by default, configurable by hiding the scroll background. ScrollView can become seamless by making the background visible.

See also

More in Appearance.