<!--
{
  "availability" : [
    "iOS: 16.4.0 -",
    "iPadOS: 16.4.0 -",
    "macCatalyst: 16.4.0 -",
    "macOS: 13.3.0 -",
    "tvOS: 16.4.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/scrollBounceBehavior(_:axes:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE20scrollBounceBehavior_4axesQrAA06ScrolleF0V_AA4AxisO3SetVtF"
  },
  "title" : "scrollBounceBehavior(_:axes:)"
}
-->

# scrollBounceBehavior(_:axes:)

Configures the bounce behavior of scrollable views along the specified
axis.

```
nonisolated func scrollBounceBehavior(_ behavior: ScrollBounceBehavior, axes: Axis.Set = [.vertical]) -> some View
```

## Parameters

`behavior`

The bounce behavior to apply to any scrollable views
within the configured view. Use one of the [`ScrollBounceBehavior`](/documentation/SwiftUI/ScrollBounceBehavior)
values.

`axes`

The set of axes to apply `behavior` to. The default is
[`Axis.vertical`](/documentation/SwiftUI/Axis/vertical).

## Return Value

A view that’s configured with the specified scroll bounce
behavior.

## Discussion

Use this modifier to indicate whether scrollable views bounce when
people scroll to the end of the view’s content, taking into account the
relative sizes of the view and its content. For example, the following
[`ScrollView`](/documentation/SwiftUI/ScrollView) only enables bounce behavior if its content is large
enough to require scrolling:

```
ScrollView {
    Text("Small")
    Text("Content")
}
.scrollBounceBehavior(.basedOnSize)
```

The modifier passes the scroll bounce mode through the [`Environment`](/documentation/SwiftUI/Environment),
which means that the mode affects any scrollable views in the modified
view hierarchy. Provide an axis to the modifier to constrain the kinds
of scrollable views that the mode affects. For example, all the scroll
views in the following example can access the mode value, but
only the two nested scroll views are affected, because only they use
horizontal scrolling:

```
ScrollView { // Defaults to vertical scrolling.
    ScrollView(.horizontal) {
        ShelfContent()
    }
    ScrollView(.horizontal) {
        ShelfContent()
    }
}
.scrollBounceBehavior(.basedOnSize, axes: .horizontal)
```

You can use this modifier to configure any kind of scrollable view,
including [`ScrollView`](/documentation/SwiftUI/ScrollView), [`List`](/documentation/SwiftUI/List), [`Table`](/documentation/SwiftUI/Table), and [`TextEditor`](/documentation/SwiftUI/TextEditor):

```
List {
    Text("Hello")
    Text("World")
}
.scrollBounceBehavior(.basedOnSize)
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)