New Compose Multiplatform components arrived on Composables UICheck it out →

Component in Compose Foundation

HorizontalScrollbar

Desktop

Horizontal scrollbar that can be attached to some scrollable component (Modifier.verticalScroll(), LazyRow) and share common state with it.

Can be placed independently.

Last updated:

Installation

dependencies {
   implementation("androidx.compose.foundation:foundation:1.7.0-beta04")
}

Overloads

@Composable
fun HorizontalScrollbar(
    adapter: ScrollbarAdapter,
    modifier: Modifier = Modifier,
    reverseLayout: Boolean = false,
    style: ScrollbarStyle = LocalScrollbarStyle.current,
    interactionSource: MutableInteractionSource? = null
)

Parameters

namedescription
adapter[ScrollbarAdapter] that will be used to communicate with scrollable component
modifierthe modifier to apply to this layout
reverseLayoutreverse the direction of scrolling and layout, when true and [LazyListState.firstVisibleItemIndex] == 0 then scrollbar will be at the end of the container. It is usually used in pair with LazyRow(reverseLayout = true)
style[ScrollbarStyle] to define visual style of scrollbar
interactionSourceoptional [MutableInteractionSource] that will be used to dispatch [DragInteraction.Start] when this Scrollbar is being dragged.