androidx.compose.material3

TopAppBarDefaults

Object

No hand-written docs yet.

Contains default values used for the top app bar implementations.

object TopAppBarDefaults

Properties

ContentPaddingSince 1.10

val ContentPadding: PaddingValues

Default padding used for TopAppBar content

windowInsets

@Composable val windowInsets: WindowInsets

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

snapAnimationSpecSince 1.12

@Composable val snapAnimationSpec: AnimationSpec<Float>

Default 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.

TopAppBarExpandedHeight

val TopAppBarExpandedHeight: Dp

The default expanded height of a TopAppBar and the CenterAlignedTopAppBar.

MediumAppBarCollapsedHeight

val MediumAppBarCollapsedHeight: Dp

The default height of a MediumTopAppBar when collapsed by a TopAppBarScrollBehavior.

MediumAppBarExpandedHeight

val MediumAppBarExpandedHeight: Dp

The default expanded height of a MediumTopAppBar.

MediumFlexibleAppBarWithoutSubtitleExpandedHeightSince 1.9

val MediumFlexibleAppBarWithoutSubtitleExpandedHeight: Dp

The default expanded height of a MediumFlexibleTopAppBar without subtitle.

MediumFlexibleAppBarWithSubtitleExpandedHeightSince 1.9

val MediumFlexibleAppBarWithSubtitleExpandedHeight: Dp

The default expanded height of a MediumFlexibleTopAppBar with subtitle.

LargeAppBarCollapsedHeight

val LargeAppBarCollapsedHeight: Dp

The default height of a LargeTopAppBar when collapsed by a TopAppBarScrollBehavior.

LargeAppBarExpandedHeight

val LargeAppBarExpandedHeight: Dp

The default expanded height of a LargeTopAppBar.

LargeFlexibleAppBarWithoutSubtitleExpandedHeightSince 1.9

val LargeFlexibleAppBarWithoutSubtitleExpandedHeight: Dp

The default expanded height of a LargeFlexibleTopAppBar without subtitle.

LargeFlexibleAppBarWithSubtitleExpandedHeightSince 1.9

val LargeFlexibleAppBarWithSubtitleExpandedHeight: Dp

The default expanded height of a LargeFlexibleTopAppBar with subtitle.

Functions

topAppBarColors

@Composable
fun topAppBarColors(): TopAppBarColors

Creates a TopAppBarColors for small TopAppBar. The default implementation animates between the provided colors according to the Material Design specification.

@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 for small TopAppBar. The default implementation animates between the provided colors according to the Material Design specification.

pinnedScrollBehavior

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

Returns a pinned TopAppBarScrollBehavior that tracks nested-scroll callbacks and updates its TopAppBarState.contentOffset accordingly. Note: If your layout utilizes reverseLayout or reverseScrolling, please use the overload that takes a ScrollableState parameter.

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

Returns a pinned TopAppBarScrollBehavior that tracks nested-scroll callbacks and updates its TopAppBarState.contentOffset accordingly.

enterAlwaysScrollBehavior

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

Returns a TopAppBarScrollBehavior. A top app bar that is set up with this 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 or reverseScrolling, please use the overload that takes a ScrollableState parameter.

@Composable
fun enterAlwaysScrollBehavior(
    scrollableState: ScrollableState,
    state: TopAppBarState = rememberTopAppBarState(),
    canScroll: () -> Boolean = { true },
    snapAnimationSpec: AnimationSpec<Float>? = TopAppBarDefaults.snapAnimationSpec,
    flingAnimationSpec: DecayAnimationSpec<Float>? = rememberSplineBasedDecay(),
): TopAppBarScrollBehavior

Returns a TopAppBarScrollBehavior. A top app bar that is set up with this TopAppBarScrollBehavior will immediately collapse when the content is pulled up, and will immediately appear when the content is pulled down.

exitUntilCollapsedScrollBehavior

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

Returns a TopAppBarScrollBehavior that adjusts its properties to affect the colors and height of the top app bar.

Library docs

Contains default values used for the top app bar implementations.