---
title: "scroll"
description: "Call this function to take control of scrolling and gain the ability to send scroll events via [ScrollScope.scrollBy]."
type: "function"
---
## API Reference

### scroll

> Source set: Common

```kotlin
override suspend fun scroll(
        scrollPriority: MutatePriority,
        block: suspend ScrollScope.() -> Unit,
    )
```

Call this function to take control of scrolling and gain the ability to send scroll events
via `ScrollScope.scrollBy`. All actions that change the logical scroll position must be
performed within a [scroll](/jetpack-compose/androidx.compose.foundation/foundation/functions/scroll/api) block (even if they don't call any other methods on this object)
in order to guarantee that mutual exclusion is enforced.

If [scroll](/jetpack-compose/androidx.compose.foundation/foundation/functions/scroll/api) is called from elsewhere, this will be canceled.
