scrollIndicators

Sets the visibility of scroll indicators within this view.

View ModifieriOS 16.0+macOS 13.0+tvOS 16.0+watchOS 9.0+scrollIndicators(_:axes:) in SwiftUI

Declaration

React
compose().scrollIndicators(
  visibility: SwiftUI.ScrollIndicatorVisibility,
  options?: {
    axes?: SwiftUI.AxisSet;
  }
)
Swift
nonisolated func scrollIndicators(
    _ visibility: ScrollIndicatorVisibility,
    axes: Axis.Set = [.vertical, .horizontal]
) -> some View

Parameters

Return value

A view with the specified scroll indicator visibility.

Discussion

Use this modifier to hide or show scroll indicators on scrollable content in views like a ScrollView, List, or TextEditor. This modifier applies the preferred visibility to any scrollable content within a view hierarchy.

ScrollView {
    VStack(alignment: .leading) {
        ForEach(0..<100) {
            Text("Row \($0)")
        }
    }
}
.scrollIndicators(.hidden)

Use the ScrollIndicatorVisibility.hidden value to indicate that you prefer that views never show scroll indicators along a given axis. Use ScrollIndicatorVisibility.visible when you prefer that views show scroll indicators. Depending on platform conventions, visible scroll indicators might only appear while scrolling. Pass ScrollIndicatorVisibility.automatic to allow views to decide whether or not to show their indicators.

See also

More in Layout.