# ScrollIndicatorState

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/ScrollIndicator.kt+class:androidx.compose.foundation.ScrollIndicatorState) Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.10.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface ScrollIndicatorState
  ```

*** ** * ** ***

Represents the state required to draw a scroll indicator (e.g., a scrollbar), which is typically provided by a scrollable component.

For scrollable components with a large number of items, such as lazy layouts, implementations may need to provide a reasonable heuristic for properties like `https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState#scrollOffset()` and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState#contentSize()`, as calculating the exact value might be computationally expensive or impossible.

## Summary

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState#contentSize()` The total size of the scrollable content, typically in pixels. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState#scrollOffset()` The current scroll offset of the content from the visual start of the container, typically in pixels. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState#viewportSize()` The size of the visible portion of the scrollable content, typically in pixels. | Cmn |

## Public properties

### contentSize

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.10.0)

```
val contentSize: Int
```

The total size of the scrollable content, typically in pixels.

For a vertical scrollable component, this is the total height of the content. For a horizontal scrollable component, this is the total width of the content.

For lazy layouts, this value may represent an estimated total size of content, and may change as `https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState#scrollOffset()` changes.

The scroll range (how far the content can scroll) can be determined by subtracting the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState#viewportSize()` from this `https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState#contentSize()`.

Implementations should return `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/-companion/-m-a-x_-v-a-l-u-e.html` if this value is not yet known.

### scrollOffset

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.10.0)

```
val scrollOffset: Int
```

The current scroll offset of the content from the visual start of the container, typically in pixels.

For a vertical scrollable component, it's the offset from the top edge. For a horizontal scrollable component, it's the offset from the left edge in LTR or the right edge in RTL. This absolute offset is unaffected by reverse layout or reverse scrolling.

For lazy layouts, this value may represent an estimated scroll offset.

Implementations should return `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/-companion/-m-a-x_-v-a-l-u-e.html` if this value is not yet known.

### viewportSize

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.10.0)

```
val viewportSize: Int
```

The size of the visible portion of the scrollable content, typically in pixels.

For a vertical scrollable component, this is the height of the viewport. For a horizontal scrollable component, this is the width of the viewport.

Implementations should return `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/-companion/-m-a-x_-v-a-l-u-e.html` if this value is not yet known.