TextEditor. They control the background, indicator visibility, bounce/stretch edge effects, programmatic position, and scroll snapping.
For carousel-style snapping, pair scrollTargetLayout (on the inner container) with scrollTargetBehavior (on the outer ScrollView). Most other modifiers are applied directly to the scrolling component.
scrollContentBackground
Controls the visibility of the scroll content background.Whether to show or hide the default background. Use
"hidden" to remove the system background from Lists and other scrollable containers.scrollPosition
Tracks and controls scroll position by child view ID.Children must have
.id() set for scroll position tracking to work. Use with scrollTargetLayout and scrollTargetBehavior for snapping scroll views.scrollIndicators
Controls the visibility of scroll indicators on a scroll view.The scroll indicator visibility. One of:
"automatic"— system default behavior (show when scrolling, hide when idle)"visible"— always show scroll indicators"hidden"— hide scroll indicators when possible"never"— never show scroll indicators
Object form for axis-targeted control.
The difference between
"hidden" and "never" is that "hidden" allows the system to show indicators in certain accessibility contexts, while "never" unconditionally hides them.scrollEdgeEffectHidden
Hides the scroll edge bounce or stretch effect.Whether to hide the edge effect. Defaults to
true when called without arguments.scrollEdgeEffectStyle
Sets the visual style for the scroll edge effect.scrollTargetLayout
Marks a container’s children as scroll snap targets.Whether the layout acts as a scroll target. Defaults to
true..scrollTargetLayout() to the inner container (e.g., HStack) and .scrollTargetBehavior("viewAligned") to the outer ScrollView.
scrollTargetBehavior
Sets scroll snapping behavior for aScrollView.
The snapping behavior:
"viewAligned"— snaps to child views marked with.scrollTargetLayout()"paging"— snaps to page boundaries (one screen width or height at a time)
See also
- ScrollView — scrollable container
- List — scrollable list with native row chrome
- List chrome — list-specific row and style modifiers
- Axis — axis values for indicator targeting
- EdgeSet — edge selectors for edge effects