ScrollbarState

State for controlling and managing the scrollbar's properties and activity. This state is responsible for tracking the scrollbar's position, length, and drag activity.

See also

Properties

Link copied to clipboard

barBounds Defines the rectangular bounds of the scrollbar's track.

Link copied to clipboard

Returns the length of the scrollbar track based on its orientation.

Link copied to clipboard

contentLength is the total length of the scrollable content.

Link copied to clipboard

Returns the expanded bounds for detecting drag interactions on the scrollbar.

Link copied to clipboard

indicatorBounds Defines the rectangular bounds of the scrollbar's indicator (thumb).

Link copied to clipboard

Returns the length of the indicator (thumb) based on the scrollbar's orientation.

Link copied to clipboard

indicatorOffset A mutable state representing the offset of the scrollbar's indicator (thumb). The offset indicates the current position of the thumb along the scrollbar.

Link copied to clipboard

isScrollbarDragActive is a state indicating whether the scrollbar is currently being dragged by the user. This state can be used to alter the UI, such as highlighting the scrollbar when active.

Link copied to clipboard

viewPortLength The length of the viewport (visible area) of the scrollable container.

Functions

Link copied to clipboard
suspend fun dragBy(indicatorOffset: Float): Float

Drag the scrollbar by a specified offset amount.

Link copied to clipboard
suspend fun dragTo(indicatorOffset: Float): Float

Drag the scrollbar to a specified indicator offset.

Link copied to clipboard
open override fun toString(): String