---
title: "LazyLayoutScrollScope"
description: "A [ScrollScope] to allow customization of scroll sessions in LazyLayouts. This scope contains
additional information to perform a custom scroll session in a scrollable LazyLayout.

For implementations for the most common layouts see:"
type: "interface"
---

<div class='type'>Interface</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>



```kotlin
interface LazyLayoutScrollScope : ScrollScope
```


A `ScrollScope` to allow customization of scroll sessions in LazyLayouts. This scope contains
additional information to perform a custom scroll session in a scrollable LazyLayout.

For implementations for the most common layouts see:


## Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val firstVisibleItemIndex: Int
```


The index of the first visible item in the lazy layout.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val firstVisibleItemScrollOffset: Int
```


The offset of the first visible item.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val lastVisibleItemIndex: Int
```


The last visible item in the LazyLayout, lastVisibleItemIndex - firstVisibleItemOffset + 1 is
the number of visible items.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val itemCount: Int
```


The total item count.



## Functions

```kotlin
fun snapToItem(index: Int, offset: Int = 0)
```


Immediately scroll to `index` and settle in `offset`.

#### Parameters

| | |
| --- | --- |
| index | The position index where we should immediately snap to. |
| offset | The offset where we should immediately snap to. |



```kotlin
fun calculateDistanceTo(targetIndex: Int, targetOffset: Int = 0): Int
```


The "expected" distance to `targetIndex`. This means the "expected" offset of `targetIndex`
in the layout. In a LazyLayout, non-visible items don't have an actual offset, so this method
should return an approximation of the scroll offset to `targetIndex`. If `targetIndex` is
visible, then an "exact" offset should be provided.

#### Parameters

| | |
| --- | --- |
| targetIndex | The index position with respect to which this calculation should be done. |
| targetOffset | The offset with respect to which this calculation should be done. |


#### Returns

| | |
| --- | --- |
|  | The expected distance to scroll so `targetIndex` is the firstVisibleItemIndex with `targetOffset` as the firstVisibleItemScrollOffset. |




