# TopAppBarScrollBehavior

Artifact: [androidx.compose.material3:material3](https://developer.android.com/jetpack/androidx/releases/compose-material3) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/AppBar.kt+class:androidx.compose.material3.TopAppBarScrollBehavior) Common/AllAndroid/JVM
- Cmn

  ```
  interface TopAppBarScrollBehavior
  ```

*** ** * ** ***

A TopAppBarScrollBehavior defines how an app bar should behave when the content under it is scrolled.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/material3/TopAppBarDefaults#pinnedScrollBehavior(androidx.compose.material3.TopAppBarState,kotlin.Function0)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/material3/TopAppBarDefaults#enterAlwaysScrollBehavior(androidx.compose.material3.TopAppBarState,kotlin.Function0,androidx.compose.animation.core.AnimationSpec,androidx.compose.animation.core.DecayAnimationSpec)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/material3/TopAppBarDefaults#exitUntilCollapsedScrollBehavior(androidx.compose.material3.TopAppBarState,kotlin.Function0,androidx.compose.animation.core.AnimationSpec,androidx.compose.animation.core.DecayAnimationSpec)` |   |

## Summary

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/DecayAnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/TopAppBarScrollBehavior#flingAnimationSpec()` An optional `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/DecayAnimationSpec` that defines how to fling the top app bar when the user flings the app bar itself, or the scrollable content. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/TopAppBarScrollBehavior#isPinned()` Indicates whether the top app bar is pinned. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollConnection` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/TopAppBarScrollBehavior#nestedScrollConnection()` A `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollConnection` that should be attached to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/nestedscroll/nestedScroll.modifier#(androidx.compose.ui.Modifier).nestedScroll(androidx.compose.ui.input.nestedscroll.NestedScrollConnection,androidx.compose.ui.input.nestedscroll.NestedScrollDispatcher)` in order to keep track of the scroll events. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/TopAppBarScrollBehavior#snapAnimationSpec()` An optional `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec` that defines how the top app bar snaps to either fully collapsed or fully extended state when a fling or a drag scrolled it into an intermediate position. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/material3/TopAppBarState` | `https://developer.android.com/reference/kotlin/androidx/compose/material3/TopAppBarScrollBehavior#state()` A `https://developer.android.com/reference/kotlin/androidx/compose/material3/TopAppBarState` that is attached to this behavior and is read and updated when scrolling happens. | Cmn |

## Public properties

### flingAnimationSpec

Cmn

```
val flingAnimationSpec: DecayAnimationSpec<Float>?
```

An optional `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/DecayAnimationSpec` that defines how to fling the top app bar when the user flings the app bar itself, or the scrollable content. If `null` is provided, the app bar will not continue to animate its height based on the scroll velocity.

### isPinned

Cmn

```
val isPinned: Boolean
```

Indicates whether the top app bar is pinned.

A pinned app bar will stay fixed in place when content is scrolled and will not react to any drag gestures.

### nestedScrollConnection

Cmn

```
val nestedScrollConnection: NestedScrollConnection
```

A `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/nestedscroll/NestedScrollConnection` that should be attached to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/nestedscroll/nestedScroll.modifier#(androidx.compose.ui.Modifier).nestedScroll(androidx.compose.ui.input.nestedscroll.NestedScrollConnection,androidx.compose.ui.input.nestedscroll.NestedScrollDispatcher)` in order to keep track of the scroll events.

### snapAnimationSpec

Cmn

```
val snapAnimationSpec: AnimationSpec<Float>?
```

An optional `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec` that defines how the top app bar snaps to either fully collapsed or fully extended state when a fling or a drag scrolled it into an intermediate position. If `null` is provided, the app bar will not snap and will remain in its current state.

### state

Cmn

```
val state: TopAppBarState
```

A `https://developer.android.com/reference/kotlin/androidx/compose/material3/TopAppBarState` that is attached to this behavior and is read and updated when scrolling happens.