---
title: "scrollTransition(topLeading:bottomTrailing:axis:transition:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/scrolltransition(topleading:bottomtrailing:axis:transition:)"
---

# scrollTransition(topLeading:bottomTrailing:axis:transition:)

Applies the given transition, animating between the phases of the transition as this view appears and disappears within the visible region of the containing scroll view.

## Declaration

```swift
nonisolated func scrollTransition(topLeading: ScrollTransitionConfiguration, bottomTrailing: ScrollTransitionConfiguration, axis: Axis? = nil, transition: @escaping @Sendable (EmptyVisualEffect, ScrollTransitionPhase) -> some VisualEffect) -> some View

```

## Parameters

- `topLeading`: The configuration that drives the transition when the view is about to appear at the top edge of a vertical scroll view, or the leading edge of a horizont scroll view.
- `bottomTrailing`: The configuration that drives the transition when the view is about to appear at the bottom edge of a vertical scroll view, or the trailing edge of a horizont scroll view.
- `axis`: The axis of the containing scroll view over which the transition will be applied. The default value of nil uses the axis of the innermost containing scroll view, or .vertical if the innermost scroll view is scrollable along both axes.
- `transition`: The transition to apply.

## See Also

### Animating scroll transitions

- [scrollTransition(_:axis:transition:)](swiftui/view/scrolltransition(_:axis:transition:).md)
- [ScrollTransitionPhase](swiftui/scrolltransitionphase.md)
- [ScrollTransitionConfiguration](swiftui/scrolltransitionconfiguration.md)
