FloatingToolbarState

Interface

Common
@ExperimentalMaterial3ExpressiveApi
interface FloatingToolbarState

A state object that can be hoisted to control and observe the floating toolbar state. The state is read and updated by a FloatingToolbarScrollBehavior implementation.

In most cases, this state will be created via rememberFloatingToolbarState.

Properties

Common
var offsetLimit: Float

The floating toolbar's offset limit in pixels, which represents the limit that a floating toolbar is allowed to collapse to.

Use this limit to coerce the offset value when it's updated.

Common
var offset: Float

The floating toolbar's current offset in pixels. This offset is applied to the fixed size of the toolbar to control the displayed size when content is being scrolled.

Updates to the offset value are coerced between zero and offsetLimit.

Common
var contentOffset: Float

The total offset of the content scrolled under the floating toolbar.

This value is updated by a FloatingToolbarScrollBehavior whenever a nested scroll connection consumes scroll events. A common implementation would update the value to be the sum of all NestedScrollConnection.onPostScroll consumed values.