HorizontalScrollbar
fun HorizontalScrollbar(adapter: ScrollbarAdapter, modifier: Modifier = Modifier, reverseLayout: Boolean = false, style: ScrollbarStyle = LocalScrollbarStyle.current, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })
Horizontal scrollbar that can be attached to some scrollable component (Modifier.verticalScroll(), LazyRow) and share common state with it.
Can be placed independently.
Example: val state = rememberScrollState(0)
Box(Modifier.fillMaxSize()) {
Box(modifier = Modifier.verticalScroll(state)) {
...
}
HorizontalScrollbar(
adapter = rememberScrollbarAdapter(state)
modifier = Modifier.align(Alignment.CenterEnd).fillMaxWidth(),
)
}Content copied to clipboard
Parameters
adapter
ScrollbarAdapter that will be used to communicate with scrollable component
modifier
the modifier to apply to this layout
reverseLayout
reverse 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
interactionSource
MutableInteractionSource that will be used to dispatch DragInteraction.Start when this Scrollbar is being dragged.