# rememberLazyListState

Common/All

## Functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/rememberLazyListState.composable#rememberLazyListState(kotlin.Int,kotlin.Int)( initialFirstVisibleItemIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, initialFirstVisibleItemScrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Creates a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState` that is remembered across compositions. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/ExperimentalFoundationApi @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable [rememberLazyListState](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/rememberLazyListState.composable#rememberLazyListState(androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow,kotlin.Int,kotlin.Int))( cacheWindow: https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutCacheWindow, initialFirstVisibleItemIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, initialFirstVisibleItemScrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` **This function is deprecated.** \`CacheWindow\` is now specified via lazy list composable arguments as \`CacheWindow\`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/ExperimentalFoundationApi @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable [rememberLazyListState](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/rememberLazyListState.composable#rememberLazyListState(kotlin.Int,kotlin.Int,androidx.compose.foundation.lazy.LazyListPrefetchStrategy))( initialFirstVisibleItemIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, initialFirstVisibleItemScrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, prefetchStrategy: https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListPrefetchStrategy )` **This function is deprecated.** Providing \`LazyLayoutCacheWindow\` via \`LazyColumn\` or \`LazyRow\` composables should be preferred over using \`LazyListPrefetchStrategy\` here. | Cmn |

## Functions

### rememberLazyListState

Cmn 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/lazy/LazyListState.kt+function:rememberLazyListState) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0)

```
@Composable
fun rememberLazyListState(
    initialFirstVisibleItemIndex: Int = 0,
    initialFirstVisibleItemScrollOffset: Int = 0
): LazyListState
```

Creates a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState` that is remembered across compositions.

Changes to the provided initial values will **not** result in the state being recreated or changed in any way if it has already been created.

| Parameters |
|---|---|
| `initialFirstVisibleItemIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the initial value for `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState#firstVisibleItemIndex()` |
| `initialFirstVisibleItemScrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the initial value for `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState#firstVisibleItemScrollOffset()` |

### rememberLazyListState

Cmn 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/lazy/LazyListState.kt+function:rememberLazyListState) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0) Deprecated in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01)

```
@ExperimentalFoundationApi
@Composable
fun [rememberLazyListState](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/rememberLazyListState.composable#rememberLazyListState(androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow,kotlin.Int,kotlin.Int))(
    cacheWindow: LazyLayoutCacheWindow,
    initialFirstVisibleItemIndex: Int = 0,
    initialFirstVisibleItemScrollOffset: Int = 0
): LazyListState
```

> [!CAUTION]
> **This function is deprecated.**   
> \`CacheWindow\` is now specified via lazy list composable arguments as \`CacheWindow\`.

Creates a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState` that is remembered across compositions.

Changes to the provided initial values will **not** result in the state being recreated or changed in any way if it has already been created.

| Parameters |
|---|---|
| `cacheWindow: https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutCacheWindow` | specifies the size of the ahead and behind window to be used as per `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutCacheWindow`. |
| `initialFirstVisibleItemIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the initial value for `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState#firstVisibleItemIndex()` |
| `initialFirstVisibleItemScrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the initial value for `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState#firstVisibleItemScrollOffset()` |

### rememberLazyListState

Cmn 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/lazy/LazyListState.kt+function:rememberLazyListState) Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0) Deprecated in [1.13.0-rc01](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.13.0-rc01)

```
@ExperimentalFoundationApi
@Composable
fun [rememberLazyListState](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/rememberLazyListState.composable#rememberLazyListState(kotlin.Int,kotlin.Int,androidx.compose.foundation.lazy.LazyListPrefetchStrategy))(
    initialFirstVisibleItemIndex: Int = 0,
    initialFirstVisibleItemScrollOffset: Int = 0,
    prefetchStrategy: LazyListPrefetchStrategy = remember { LazyListPrefetchStrategy() }
): LazyListState
```

> [!CAUTION]
> **This function is deprecated.**   
> Providing \`LazyLayoutCacheWindow\` via \`LazyColumn\` or \`LazyRow\` composables should be preferred over using \`LazyListPrefetchStrategy\` here.

Creates a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState` that is remembered across compositions.

Changes to the provided initial values will **not** result in the state being recreated or changed in any way if it has already been created.

| Parameters |
|---|---|
| `initialFirstVisibleItemIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the initial value for `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState#firstVisibleItemIndex()` |
| `initialFirstVisibleItemScrollOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the initial value for `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState#firstVisibleItemScrollOffset()` |
| `prefetchStrategy: https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListPrefetchStrategy = remember { LazyListPrefetchStrategy() }` | the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListPrefetchStrategy` to use for prefetching content in this list |