---
title: "scrollDisabled(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/scrolldisabled(_:)"
---

# scrollDisabled(_:)

Disables or enables scrolling in scrollable views.

## Declaration

```swift
nonisolated func scrollDisabled(_ disabled: Bool) -> some View

```

## Parameters

- `disabled`: A Boolean that indicates whether scrolling is disabled.

## Discussion

Discussion Use this modifier to control whether a ScrollView can scroll: @State private var isScrollDisabled = false

var body: some View {     ScrollView {         VStack {             Toggle("Disable", isOn: $isScrollDisabled)             MyContent()         }     }     .scrollDisabled(isScrollDisabled) } SwiftUI passes the disabled property through the environment, which means you can use this modifier to disable scrolling for all scroll views within a view hierarchy. In the following example, the modifier affects both scroll views:  ScrollView {      ForEach(rows) { row in          ScrollView(.horizontal) {              RowContent(row)          }      }  }  .scrollDisabled(true) You can also use this modifier to disable scrolling for other kinds of scrollable views, like a List or a TextEditor.

## See Also

### Disabling scrolling

- [isScrollEnabled](swiftui/environmentvalues/isscrollenabled.md)
