HorizontalPagerScaffold

Composable Component

HorizontalPagerScaffold is one of the Wear Material3 scaffold components.

Android
@Composable
public fun HorizontalPagerScaffold(
    pagerState: PagerState,
    modifier: Modifier = Modifier,
    pageIndicator: (@Composable BoxScope.() -> Unit)? = { HorizontalPageIndicator(pagerState) },
    pageIndicatorAnimationSpec: AnimationSpec<Float>? = null,
    content: @Composable () -> Unit,
): Unit

Parameters

pagerStateThe state of the pager controlling the page content.
modifierThe modifier to be applied to the scaffold.
pageIndicatorA composable function that defines the page indicator to be displayed. By default, it uses a HorizontalPageIndicator.
pageIndicatorAnimationSpec- An optional parameter to set whether the page indicator should fade out when paging has finished. This is useful for when the underlying page content conflicts with the page indicator. By default this is null, so the page indicator will be visible at all times, setting this to PagerScaffoldDefaults.FadeOutAnimationSpec ensures the indicator only shows during paging, and fades out when the Pager is idle.
contentA composable function where a HorizontalPager can be added.