<div class='sourceset sourceset-common'>Common</div>

```kotlin
object TopAppBarDefaults
```

Contains default values used for the top app bar implementations.

## Properties

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val ContentPadding = PaddingValues(all = 0.dp)
```

Default padding used for [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar) content

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val windowInsets: WindowInsets
```

Default insets to be used and consumed by the top app bars

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val TopAppBarExpandedHeight: Dp
```

The default expanded height of a [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar) and the [CenterAlignedTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/CenterAlignedTopAppBar).

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val MediumAppBarCollapsedHeight: Dp
```

The default height of a [MediumTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/MediumTopAppBar) when collapsed by a [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior).

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val MediumAppBarExpandedHeight: Dp
```

The default expanded height of a [MediumTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/MediumTopAppBar).

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val MediumFlexibleAppBarWithoutSubtitleExpandedHeight: Dp
```

The default expanded height of a [MediumFlexibleTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/MediumFlexibleTopAppBar) without subtitle.

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val MediumFlexibleAppBarWithSubtitleExpandedHeight: Dp
```

The default expanded height of a [MediumFlexibleTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/MediumFlexibleTopAppBar) with subtitle.

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val LargeAppBarCollapsedHeight: Dp
```

The default height of a [LargeTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/LargeTopAppBar) when collapsed by a [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior).

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val LargeAppBarExpandedHeight: Dp
```

The default expanded height of a [LargeTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/LargeTopAppBar).

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val LargeFlexibleAppBarWithoutSubtitleExpandedHeight: Dp
```

The default expanded height of a [LargeFlexibleTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/LargeFlexibleTopAppBar) without subtitle.

<div class='sourceset sourceset-common'>Common</div>

```kotlin
val LargeFlexibleAppBarWithSubtitleExpandedHeight: Dp
```

The default expanded height of a [LargeFlexibleTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/LargeFlexibleTopAppBar) with subtitle.

## Functions

```kotlin
@Composable fun topAppBarColors() = MaterialTheme.colorScheme.defaultTopAppBarColors
```

Creates a [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) for small [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar). The default implementation animates
between the provided colors according to the Material Design specification.

<h2 id="topappbarcolors-containercolor-scrolledcontainercolor-navigationiconcontentcolor-titlecontentcolor-actioniconcontentcolor-subtitlecontentcolor">topAppBarColors</h2>

```kotlin
@Composable
    fun topAppBarColors(
        containerColor: Color = Color.Unspecified,
        scrolledContainerColor: Color = Color.Unspecified,
        navigationIconContentColor: Color = Color.Unspecified,
        titleContentColor: Color = Color.Unspecified,
        actionIconContentColor: Color = Color.Unspecified,
        subtitleContentColor: Color = Color.Unspecified,
    ): TopAppBarColors
```

Creates a [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) for small [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar). The default implementation animates
between the provided colors according to the Material Design specification.

#### Parameters

| | |
| --- | --- |
| containerColor | the container color |
| scrolledContainerColor | the container color when content is scrolled behind it |
| navigationIconContentColor | the content color used for the navigation icon |
| titleContentColor | the content color used for the title |
| actionIconContentColor | the content color used for actions |
| subtitleContentColor | the content color used for the subtitle |

#### Returns

| | |
| --- | --- |
|  | the resulting [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) used for the top app bar |

<hr class="docs-overload-divider">

<h2 id="topappbarcolors-containercolor-scrolledcontainercolor-navigationiconcontentcolor-titlecontentcolor-actioniconcontentcolor">topAppBarColors</h2>

```kotlin
@Composable
    fun topAppBarColors(
        containerColor: Color = Color.Unspecified,
        scrolledContainerColor: Color = Color.Unspecified,
        navigationIconContentColor: Color = Color.Unspecified,
        titleContentColor: Color = Color.Unspecified,
        actionIconContentColor: Color = Color.Unspecified,
    ): TopAppBarColors
```

Creates a [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) for small [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar). The default implementation animates
between the provided colors according to the Material Design specification.

#### Parameters

| | |
| --- | --- |
| containerColor | the container color |
| scrolledContainerColor | the container color when content is scrolled behind it |
| navigationIconContentColor | the content color used for the navigation icon |
| titleContentColor | the content color used for the title |
| actionIconContentColor | the content color used for actions |

#### Returns

| | |
| --- | --- |
|  | the resulting [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) used for the top app bar |

<hr class="docs-overload-divider">

<h2 id="centeralignedtopappbarcolors">centerAlignedTopAppBarColors</h2>

```kotlin
@Composable
    fun centerAlignedTopAppBarColors() = MaterialTheme.colorScheme.defaultTopAppBarColors
```

Creates a [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) for [CenterAlignedTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/CenterAlignedTopAppBar)s. The default implementation
animates between the provided colors according to the Material Design specification.

<hr class="docs-overload-divider">

<h2 id="centeralignedtopappbarcolors-containercolor-scrolledcontainercolor-navigationiconcontentcolor-titlecontentcolor-actioniconcontentcolor">centerAlignedTopAppBarColors</h2>

```kotlin
@Composable
    fun centerAlignedTopAppBarColors(
        containerColor: Color = Color.Unspecified,
        scrolledContainerColor: Color = Color.Unspecified,
        navigationIconContentColor: Color = Color.Unspecified,
        titleContentColor: Color = Color.Unspecified,
        actionIconContentColor: Color = Color.Unspecified,
    ): TopAppBarColors
```

Creates a [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) for [CenterAlignedTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/CenterAlignedTopAppBar)s. The default implementation
animates between the provided colors according to the Material Design specification.

#### Parameters

| | |
| --- | --- |
| containerColor | the container color |
| scrolledContainerColor | the container color when content is scrolled behind it |
| navigationIconContentColor | the content color used for the navigation icon |
| titleContentColor | the content color used for the title |
| actionIconContentColor | the content color used for actions |

#### Returns

| | |
| --- | --- |
|  | the resulting [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) used for the top app bar |

<hr class="docs-overload-divider">

<h2 id="mediumtopappbarcolors">mediumTopAppBarColors</h2>

```kotlin
@Composable
    fun mediumTopAppBarColors() = MaterialTheme.colorScheme.defaultTopAppBarColors
```

Creates a [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) for [MediumTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/MediumTopAppBar)s. The default implementation interpolates
between the provided colors as the top app bar scrolls according to the Material Design
specification.

<hr class="docs-overload-divider">

<h2 id="mediumtopappbarcolors-containercolor-scrolledcontainercolor-navigationiconcontentcolor-titlecontentcolor-actioniconcontentcolor">mediumTopAppBarColors</h2>

```kotlin
@Composable
    fun mediumTopAppBarColors(
        containerColor: Color = Color.Unspecified,
        scrolledContainerColor: Color = Color.Unspecified,
        navigationIconContentColor: Color = Color.Unspecified,
        titleContentColor: Color = Color.Unspecified,
        actionIconContentColor: Color = Color.Unspecified,
    ): TopAppBarColors
```

Creates a [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) for [MediumTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/MediumTopAppBar)s. The default implementation interpolates
between the provided colors as the top app bar scrolls according to the Material Design
specification.

#### Parameters

| | |
| --- | --- |
| containerColor | the container color |
| scrolledContainerColor | the container color when content is scrolled behind it |
| navigationIconContentColor | the content color used for the navigation icon |
| titleContentColor | the content color used for the title |
| actionIconContentColor | the content color used for actions |

#### Returns

| | |
| --- | --- |
|  | the resulting [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) used for the top app bar |

<hr class="docs-overload-divider">

<h2 id="largetopappbarcolors">largeTopAppBarColors</h2>

```kotlin
@Composable
    fun largeTopAppBarColors() = MaterialTheme.colorScheme.defaultTopAppBarColors
```

Creates a [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) for [LargeTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/LargeTopAppBar)s. The default implementation interpolates
between the provided colors as the top app bar scrolls according to the Material Design
specification.

<hr class="docs-overload-divider">

<h2 id="largetopappbarcolors-containercolor-scrolledcontainercolor-navigationiconcontentcolor-titlecontentcolor-actioniconcontentcolor">largeTopAppBarColors</h2>

```kotlin
@Composable
    fun largeTopAppBarColors(
        containerColor: Color = Color.Unspecified,
        scrolledContainerColor: Color = Color.Unspecified,
        navigationIconContentColor: Color = Color.Unspecified,
        titleContentColor: Color = Color.Unspecified,
        actionIconContentColor: Color = Color.Unspecified,
    ): TopAppBarColors
```

Creates a [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) for [LargeTopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/LargeTopAppBar)s. The default implementation interpolates
between the provided colors as the top app bar scrolls according to the Material Design
specification.

#### Parameters

| | |
| --- | --- |
| containerColor | the container color |
| scrolledContainerColor | the container color when content is scrolled behind it |
| navigationIconContentColor | the content color used for the navigation icon |
| titleContentColor | the content color used for the title |
| actionIconContentColor | the content color used for actions |

#### Returns

| | |
| --- | --- |
|  | the resulting [TopAppBarColors](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarColors) used for the top app bar |

<hr class="docs-overload-divider">

<h2 id="pinnedscrollbehavior-state-canscroll">pinnedScrollBehavior</h2>

```kotlin
@Composable
    fun pinnedScrollBehavior(
        state: TopAppBarState = rememberTopAppBarState(),
        canScroll: () -> Boolean = { true },
    ): TopAppBarScrollBehavior
```

Returns a pinned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) that tracks nested-scroll callbacks and updates
its [TopAppBarState.contentOffset](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarState) accordingly. Note: If your layout utilizes `reverseLayout`
with [LazyListState](/jetpack-compose/androidx.compose.foundation/foundation/classes/LazyListState) or involves `reverseScrolling` with [ScrollState](/jetpack-compose/androidx.compose.foundation/foundation/classes/ScrollState), consider using other
overloads that are specifically designed for these use cases.

The returned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) is remembered across compositions.

#### Parameters

| | |
| --- | --- |
| state | the state object to be used to control or observe the top app bar's scroll state. See [rememberTopAppBarState](/jetpack-compose/androidx.compose.material3/material3/composable-functions/rememberTopAppBarState) for a state that is remembered across compositions. |
| canScroll | a callback used to determine whether scroll events are to be handled by this pinned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) |

<hr class="docs-overload-divider">

<h2 id="pinnedscrollbehavior-lazyliststate-state-canscroll">pinnedScrollBehavior</h2>

```kotlin
@Composable
    fun pinnedScrollBehavior(
        lazyListState: LazyListState,
        state: TopAppBarState = rememberTopAppBarState(),
        canScroll: () -> Boolean = { true },
    ): TopAppBarScrollBehavior
```

Returns a pinned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) that tracks nested-scroll callbacks and updates
its [TopAppBarState.contentOffset](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarState) accordingly.

This overload is intended for use cases with [LazyColumn](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/LazyColumn) when the content is pre-scrolled or
uses `reverseLayout`, as it correctly handles [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar) color transitions for these
specific scroll states.

The returned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) is remembered across compositions.

A sample for a pinned small [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar) when the content of the [LazyColumn](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/LazyColumn) is pre-scrolled:

#### Parameters

| | |
| --- | --- |
| lazyListState | the [LazyListState](/jetpack-compose/androidx.compose.foundation/foundation/classes/LazyListState) object observing the list's scroll position, used to determine if the list is scrolled to the start |
| state | the state object to be used to control or observe the top app bar's scroll state. See [rememberTopAppBarState](/jetpack-compose/androidx.compose.material3/material3/composable-functions/rememberTopAppBarState) for a state that is remembered across compositions |
| canScroll | a callback used to determine whether scroll events are to be handled by this pinned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) |

<hr class="docs-overload-divider">

<h2 id="pinnedscrollbehavior-scrollstate-reversescrolling-state-canscroll">pinnedScrollBehavior</h2>

```kotlin
@Composable
    fun pinnedScrollBehavior(
        scrollState: ScrollState,
        reverseScrolling: Boolean = false,
        state: TopAppBarState = rememberTopAppBarState(),
        canScroll: () -> Boolean = { true },
    ): TopAppBarScrollBehavior
```

Returns a pinned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) that tracks nested-scroll callbacks and updates
its [TopAppBarState.contentOffset](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarState) accordingly.

This overload is intended for use cases with composables that use a [ScrollState](/jetpack-compose/androidx.compose.foundation/foundation/classes/ScrollState), such as
[Column](/jetpack-compose/androidx.compose.foundation/foundation-layout/composable-functions/Column) with `verticalScroll`, especially when the content is pre-scrolled or uses
`reverseScrolling`. It correctly handles [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar) color transitions for these specific
scroll states.

The returned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) is remembered across compositions.

#### Parameters

| | |
| --- | --- |
| scrollState | state of the scroll |
| reverseScrolling | reverse the direction of scrolling, when `true`, 0 [ScrollState.value](/jetpack-compose/androidx.compose.foundation/foundation/classes/ScrollState) will mean bottom, when `false`, 0 [ScrollState.value](/jetpack-compose/androidx.compose.foundation/foundation/classes/ScrollState) will mean top |
| state | the state object to be used to control or observe the top app bar's scroll state. See [rememberTopAppBarState](/jetpack-compose/androidx.compose.material3/material3/composable-functions/rememberTopAppBarState) for a state that is remembered across compositions |
| canScroll | a callback used to determine whether scroll events are to be handled by this pinned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) |

<hr class="docs-overload-divider">

<h2 id="pinnedscrollbehavior-state-canscroll-isscrollingcontentatstart">pinnedScrollBehavior</h2>

```kotlin
@Composable
    fun pinnedScrollBehavior(
        state: TopAppBarState = rememberTopAppBarState(),
        canScroll: () -> Boolean = { true },
        isScrollingContentAtStart: () -> Boolean = { true },
    ): TopAppBarScrollBehavior
```

Returns a pinned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) that tracks nested-scroll callbacks and updates
its [TopAppBarState.contentOffset](/jetpack-compose/androidx.compose.material3/material3/classes/TopAppBarState) accordingly.

This overload is intended for use cases that are not covered by the standard overloads, such
as when a custom `isScrollingContentAtStart` state needs to be determined for custom or
complex layouts (e.g. `LazyVerticalGrid` with `reverseLayout = true`).

The returned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) is remembered across compositions.

A sample for a pinned small [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar) that is scrolled with a reversed [LazyVerticalGrid](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/LazyVerticalGrid):

#### Parameters

| | |
| --- | --- |
| state | the state object to be used to control or observe the top app bar's scroll state. See [rememberTopAppBarState](/jetpack-compose/androidx.compose.material3/material3/composable-functions/rememberTopAppBarState) for a state that is remembered across compositions |
| canScroll | a callback used to determine whether scroll events are to be handled by this pinned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) |
| isScrollingContentAtStart | A callback that returns true when the scrollable is at the origin of its content. Handles reversed layouts to ensure "start" always refers to the first logical item. |

<hr class="docs-overload-divider">

<h2 id="enteralwaysscrollbehavior-state-canscroll-snapanimationspec-flinganimationspec">enterAlwaysScrollBehavior</h2>

```kotlin
@Composable
    fun enterAlwaysScrollBehavior(
        state: TopAppBarState = rememberTopAppBarState(),
        canScroll: () -> Boolean = { true },
        snapAnimationSpec: AnimationSpec<Float>? = MotionSchemeKeyTokens.DefaultEffects.value(),
        flingAnimationSpec: DecayAnimationSpec<Float>? = rememberSplineBasedDecay(),
    ): TopAppBarScrollBehavior
```

Returns a [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior). A top app bar that is set up with this
[TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) will immediately collapse when the content is pulled up, and will
immediately appear when the content is pulled down. Note: If your layout utilizes
`reverseLayout` with [LazyListState](/jetpack-compose/androidx.compose.foundation/foundation/classes/LazyListState) or involves `reverseScrolling` with [ScrollState](/jetpack-compose/androidx.compose.foundation/foundation/classes/ScrollState),
consider using other overloads that are specifically designed for these use cases.

The returned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) is remembered across compositions.

#### Parameters

| | |
| --- | --- |
| state | the state object to be used to control or observe the top app bar's scroll state. See [rememberTopAppBarState](/jetpack-compose/androidx.compose.material3/material3/composable-functions/rememberTopAppBarState) for a state that is remembered across compositions. |
| canScroll | a callback used to determine whether scroll events are to be handled by this [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) |
| snapAnimationSpec | an optional [AnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/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 |
| flingAnimationSpec | an optional [DecayAnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/DecayAnimationSpec) that defined how to fling the top app bar when the user flings the app bar itself, or the content below it |

<hr class="docs-overload-divider">

<h2 id="enteralwaysscrollbehavior-state-canscroll-snapanimationspec-flinganimationspec-reverselayout">enterAlwaysScrollBehavior</h2>

```kotlin
@Composable
    fun enterAlwaysScrollBehavior(
        state: TopAppBarState = rememberTopAppBarState(),
        canScroll: () -> Boolean = { true },
        snapAnimationSpec: AnimationSpec<Float>? = MotionSchemeKeyTokens.DefaultEffects.value(),
        flingAnimationSpec: DecayAnimationSpec<Float>? = rememberSplineBasedDecay(),
        reverseLayout: Boolean = false,
    ): TopAppBarScrollBehavior
```

Returns a [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior). A top app bar that is set up with this
[TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) will immediately collapse when the content is pulled up, and will
immediately appear when the content is pulled down.

The returned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) is remembered across compositions.

#### Parameters

| | |
| --- | --- |
| state | the state object to be used to control or observe the top app bar's scroll state. See [rememberTopAppBarState](/jetpack-compose/androidx.compose.material3/material3/composable-functions/rememberTopAppBarState) for a state that is remembered across compositions. |
| canScroll | a callback used to determine whether scroll events are to be handled by this `EnterAlwaysScrollBehavior` |
| snapAnimationSpec | an optional [AnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/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 |
| flingAnimationSpec | an optional [DecayAnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/DecayAnimationSpec) that defined how to fling the top app bar when the user flings the app bar itself, or the content below it |
| reverseLayout | indicates that this behavior is applied to a scrollable content that has a reversed direction of scrolling and layout |

<hr class="docs-overload-divider">

<h2 id="enteralwaysscrollbehavior-lazyliststate-state-canscroll-snapanimationspec-flinganimationspec">enterAlwaysScrollBehavior</h2>

```kotlin
@Composable
    fun enterAlwaysScrollBehavior(
        lazyListState: LazyListState,
        state: TopAppBarState = rememberTopAppBarState(),
        canScroll: () -> Boolean = { true },
        snapAnimationSpec: AnimationSpec<Float>? = MotionSchemeKeyTokens.DefaultEffects.value(),
        flingAnimationSpec: DecayAnimationSpec<Float>? = rememberSplineBasedDecay(),
    ): TopAppBarScrollBehavior
```

Returns a [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior). A top app bar that is set up with this
[TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) will immediately collapse when the content is pulled up, and will
immediately appear when the content is pulled down.

This overload is intended for use cases with [LazyColumn](/jetpack-compose/androidx.compose.foundation/foundation/composable-functions/LazyColumn) when the content is pre-scrolled or
uses `reverseLayout`, as it correctly handles [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar) color transitions for these
specific scroll states.

The returned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) is remembered across compositions.

#### Parameters

| | |
| --- | --- |
| lazyListState | the [LazyListState](/jetpack-compose/androidx.compose.foundation/foundation/classes/LazyListState) object observing the list's scroll position, used to determine if the list is scrolled to the start |
| state | the state object to be used to control or observe the top app bar's scroll state. See [rememberTopAppBarState](/jetpack-compose/androidx.compose.material3/material3/composable-functions/rememberTopAppBarState) for a state that is remembered across compositions. |
| canScroll | a callback used to determine whether scroll events are to be handled by this [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) |
| snapAnimationSpec | an optional [AnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/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 |
| flingAnimationSpec | an optional [DecayAnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/DecayAnimationSpec) that defined how to fling the top app bar when the user flings the app bar itself, or the content below it |

<hr class="docs-overload-divider">

<h2 id="enteralwaysscrollbehavior-scrollstate-reversescrolling-state-canscroll-snapanimationspec-flinganimationspec">enterAlwaysScrollBehavior</h2>

```kotlin
@Composable
    fun enterAlwaysScrollBehavior(
        scrollState: ScrollState,
        reverseScrolling: Boolean = false,
        state: TopAppBarState = rememberTopAppBarState(),
        canScroll: () -> Boolean = { true },
        snapAnimationSpec: AnimationSpec<Float>? = MotionSchemeKeyTokens.DefaultEffects.value(),
        flingAnimationSpec: DecayAnimationSpec<Float>? = rememberSplineBasedDecay(),
    ): TopAppBarScrollBehavior
```

Returns a [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior). A top app bar that is set up with this
[TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) will immediately collapse when the content is pulled up, and will
immediately appear when the content is pulled down.

This overload is intended for use cases with composables that use a [ScrollState](/jetpack-compose/androidx.compose.foundation/foundation/classes/ScrollState), such as
[Column](/jetpack-compose/androidx.compose.foundation/foundation-layout/composable-functions/Column) with `verticalScroll`, especially when the content is pre-scrolled or uses
`reverseScrolling`. It correctly handles [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar) color transitions for these specific
scroll states.

The returned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) is remembered across compositions.

A sample for a small [TopAppBar](/jetpack-compose/androidx.compose.material3/material3/components/TopAppBar) that collapses when the content is scrolled up, and appears
when the content is scrolled down, using a [Column](/jetpack-compose/androidx.compose.foundation/foundation-layout/composable-functions/Column) with reverse scrolling:

#### Parameters

| | |
| --- | --- |
| scrollState | state of the scroll |
| reverseScrolling | reverse the direction of scrolling, when `true`, 0 [ScrollState.value](/jetpack-compose/androidx.compose.foundation/foundation/classes/ScrollState) will mean bottom, when `false`, 0 [ScrollState.value](/jetpack-compose/androidx.compose.foundation/foundation/classes/ScrollState) will mean top |
| state | the state object to be used to control or observe the top app bar's scroll state. See [rememberTopAppBarState](/jetpack-compose/androidx.compose.material3/material3/composable-functions/rememberTopAppBarState) for a state that is remembered across compositions. |
| canScroll | a callback used to determine whether scroll events are to be handled by this [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) |
| snapAnimationSpec | an optional [AnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/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 |
| flingAnimationSpec | an optional [DecayAnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/DecayAnimationSpec) that defined how to fling the top app bar when the user flings the app bar itself, or the content below it |

<hr class="docs-overload-divider">

<h2 id="enteralwaysscrollbehavior-state-canscroll-snapanimationspec-flinganimationspec-isscrollingcontentatstart">enterAlwaysScrollBehavior</h2>

```kotlin
@Composable
    fun enterAlwaysScrollBehavior(
        state: TopAppBarState = rememberTopAppBarState(),
        canScroll: () -> Boolean = { true },
        snapAnimationSpec: AnimationSpec<Float>? = MotionSchemeKeyTokens.DefaultEffects.value(),
        flingAnimationSpec: DecayAnimationSpec<Float>? = rememberSplineBasedDecay(),
        isScrollingContentAtStart: () -> Boolean = { true },
    ): TopAppBarScrollBehavior
```

Returns a [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior). A top app bar that is set up with this
[TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) will immediately collapse when the content is pulled up, and will
immediately appear when the content is pulled down.

This overload is intended for use cases that are not covered by the standard overloads, such
as when a custom `isScrollingContentAtStart` state needs to be determined for custom or
complex layouts (e.g. `LazyVerticalGrid` with `reverseLayout = true`).

The returned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) is remembered across compositions.

#### Parameters

| | |
| --- | --- |
| state | the state object to be used to control or observe the top app bar's scroll state. See [rememberTopAppBarState](/jetpack-compose/androidx.compose.material3/material3/composable-functions/rememberTopAppBarState) for a state that is remembered across compositions. |
| canScroll | a callback used to determine whether scroll events are to be handled by this [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) |
| snapAnimationSpec | an optional [AnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/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 |
| flingAnimationSpec | an optional [DecayAnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/DecayAnimationSpec) that defined how to fling the top app bar when the user flings the app bar itself, or the content below it |
| isScrollingContentAtStart | A callback that returns true when the scrollable is at the origin of its content. Handles reversed layouts to ensure "start" always refers to the first logical item. |

<hr class="docs-overload-divider">

<h2 id="exituntilcollapsedscrollbehavior-state-canscroll-snapanimationspec-flinganimationspec">exitUntilCollapsedScrollBehavior</h2>

```kotlin
@Composable
    fun exitUntilCollapsedScrollBehavior(
        state: TopAppBarState = rememberTopAppBarState(),
        canScroll: () -> Boolean = { true },
        snapAnimationSpec: AnimationSpec<Float>? = MotionSchemeKeyTokens.DefaultEffects.value(),
        flingAnimationSpec: DecayAnimationSpec<Float>? = rememberSplineBasedDecay(),
    ): TopAppBarScrollBehavior
```

Returns a [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) that adjusts its properties to affect the colors and
height of the top app bar.

A top app bar that is set up with this [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) will immediately collapse
when the nested content is pulled up, and will expand back the collapsed area when the
content is pulled all the way down.

The returned [TopAppBarScrollBehavior](/jetpack-compose/androidx.compose.material3/material3/interfaces/TopAppBarScrollBehavior) is remembered across compositions.

#### Parameters

| | |
| --- | --- |
| state | the state object to be used to control or observe the top app bar's scroll state. See [rememberTopAppBarState](/jetpack-compose/androidx.compose.material3/material3/composable-functions/rememberTopAppBarState) for a state that is remembered across compositions. |
| canScroll | a callback used to determine whether scroll events are to be handled by this `ExitUntilCollapsedScrollBehavior` |
| snapAnimationSpec | an optional [AnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/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 |
| flingAnimationSpec | an optional [DecayAnimationSpec](/jetpack-compose/androidx.compose.animation/animation-core/interfaces/DecayAnimationSpec) that defined how to fling the top app bar when the user flings the app bar itself, or the content below it |