# androidx.compose.foundation.lazy.layout

Common/AllAndroid/JVM

## Interfaces

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/IntervalList` | The list consisting of multiple intervals. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutCacheWindow` | Represents an out of viewport area of a Lazy Layout where items should be cached. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent.Interval` | Common content of individual intervals in `item` DSL of lazy layouts. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider` | Provides all the needed info about the items which could be later composed and displayed as children or `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayout.composable#LazyLayout(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.layout.LazyLayoutPrefetchState,androidx.compose.foundation.lazy.layout.LazyLayoutMeasurePolicy)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutKeyIndexMap` | A key-index mapping that can be used by the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider` to keep track of indices and keys in `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayout.composable#LazyLayout(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.layout.LazyLayoutPrefetchState,androidx.compose.foundation.lazy.layout.LazyLayoutMeasurePolicy)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutMeasurePolicy` |   | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutMeasureScope` | The receiver scope of a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayout.composable#LazyLayout(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.layout.LazyLayoutPrefetchState,androidx.compose.foundation.lazy.layout.LazyLayoutMeasurePolicy)`'s measure lambda. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPinnedItemList.PinnedItem` | Item pinned in a lazy layout. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPrefetchState.PrefetchHandle` | A handle to control some aspects of the prefetch request. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPrefetchState.PrefetchResultScope` | A scope for `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPrefetchState#schedulePrecompositionAndPremeasure(kotlin.Int,androidx.compose.ui.unit.Constraints,kotlin.Function1)` callbacks. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutScrollScope` | A `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollScope` to allow customization of scroll sessions in LazyLayouts. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/NestedPrefetchScope` | A scope which allows nested prefetches to be requested for the precomposition of a LazyLayout. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/PrefetchRequest` | **This interface is deprecated.** Customization of PrefetchScheduler is no longer supported. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/PrefetchRequestScope` | **This interface is deprecated.** Customization of PrefetchScheduler is no longer supported. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/PrefetchScheduler` | **This interface is deprecated.** Customization of PrefetchScheduler is no longer supported. | Cmn |

## Classes

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/IntervalList.Interval` | The interval holder. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent` | Common parts backing the interval-based content of lazy layout defined through `item` DSL. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPinnedItemList` | Read-only list of pinned items in a lazy layout. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPrefetchState` | State for lazy items prefetching, used by lazy layouts to instruct the prefetcher. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/MutableIntervalList` | Mutable version of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/IntervalList`. | Cmn |

## Composables

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayout.composable` | A layout that only composes and lays out currently needed items. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPinnableItem.composable` | Wrapper supporting `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/PinnableContainer` in lazy layout items. | Cmn |

## Top-level functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutCacheWindow` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/package-summary#LazyLayoutCacheWindow(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,kotlin.Boolean)( ahead: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, behind: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, isNonScrollCachingEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` A Dp-based `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/package-summary#LazyLayoutCacheWindow(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,kotlin.Boolean)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutCacheWindow` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/package-summary#LazyLayoutCacheWindow(kotlin.Float,kotlin.Float,kotlin.Boolean)( aheadFraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, behindFraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, isNonScrollCachingEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Creates a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/package-summary#LazyLayoutCacheWindow(kotlin.Float,kotlin.Float,kotlin.Boolean)` based off a fraction of the viewport. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutKeyIndexMap` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/package-summary#LazyLayoutKeyIndexMap(kotlin.ranges.IntRange,androidx.compose.foundation.lazy.layout.LazyLayoutIntervalContent)( itemIndexRange: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html, intervalContent: https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent<*> )` A `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/package-summary#LazyLayoutKeyIndexMap(kotlin.ranges.IntRange,androidx.compose.foundation.lazy.layout.LazyLayoutIntervalContent)` that keeps a mapping over given `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html` of items. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/package-summary#getDefaultLazyLayoutKey(kotlin.Int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` This creates an object meeting following requirements: | Cmn android |

## Top-level functions

### LazyLayoutCacheWindow

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

```
fun LazyLayoutCacheWindow(
    ahead: Dp = 0.dp,
    behind: Dp = 0.dp,
    isNonScrollCachingEnabled: Boolean = true
): LazyLayoutCacheWindow
```

A Dp-based `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/package-summary#LazyLayoutCacheWindow(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,kotlin.Boolean)`.

| Parameters |
|---|---|
| `ahead: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = 0.dp` | The size of the ahead window to be used as per `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutCacheWindow#(androidx.compose.ui.unit.Density).calculateAheadWindow(kotlin.Int)`. |
| `behind: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = 0.dp` | The size of the behind window to be used as per `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutCacheWindow#(androidx.compose.ui.unit.Density).calculateBehindWindow(kotlin.Int)`. |
| `isNonScrollCachingEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | whether the cache window populates after a non-scroll related trigger. When set to `true`, the cache window will use non-scroll triggers to start the caching process. For example, if layout data changes and causes a cache purge, the ahead window will be refilled while the layout remains idle. Other common scenarios in which the ahead window fills include initial composition and item reordering, during which the layout is in a non-scroll state, providing the opportunity to populate the window. |

### LazyLayoutCacheWindow

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

```
fun LazyLayoutCacheWindow(
    aheadFraction: @FloatRange(from = 0.0) Float = 0.0f,
    behindFraction: @FloatRange(from = 0.0) Float = 0.0f,
    isNonScrollCachingEnabled: Boolean = true
): LazyLayoutCacheWindow
```

Creates a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/package-summary#LazyLayoutCacheWindow(kotlin.Float,kotlin.Float,kotlin.Boolean)` based off a fraction of the viewport.

| Parameters |
|---|---|
| `aheadFraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.0f` | The fraction of the viewport to be used for the ahead window. |
| `behindFraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 0.0f` | The fraction of the viewport to be used for the behind window. |
| `isNonScrollCachingEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | whether the cache window populates after a non-scroll related trigger. When set to `true`, the cache window will use non-scroll triggers to start the caching process. For example, if layout data changes and causes a cache purge, the ahead window will be refilled while the layout remains idle. Other common scenarios in which the ahead window fills include initial composition and item reordering, during which the layout is in a non-scroll state, providing the opportunity to populate the window. |

### LazyLayoutKeyIndexMap

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/layout/LazyLayoutKeyIndexMap.kt+function:LazyLayoutKeyIndexMap) Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.10.0)

```
fun LazyLayoutKeyIndexMap(
    itemIndexRange: IntRange,
    intervalContent: LazyLayoutIntervalContent<*>
): LazyLayoutKeyIndexMap
```

A `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/package-summary#LazyLayoutKeyIndexMap(kotlin.ranges.IntRange,androidx.compose.foundation.lazy.layout.LazyLayoutIntervalContent)` that keeps a mapping over given `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html` of items. Items outside of given range are considered unknown, with null returned as the index.

| Parameters |
|---|---|
| `itemIndexRange: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html` | Range of items to keep track of. |
| `intervalContent: https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent<*>` | Source of item information in the form of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent`. |

### getDefaultLazyLayoutKey

Cmn android 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/layout/Lazy+function:getDefaultLazyLayoutKey) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.3.0)

```
fun getDefaultLazyLayoutKey(index: Int): Any
```

This creates an object meeting following requirements:

1. Objects created for the same index are equals and never equals for different indexes.

2. This class is saveable via a default SaveableStateRegistry on the platform.

3. This objects can't be equals to any object which could be provided by a user as a custom key.

Note: this function is a part of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayout.composable#LazyLayout(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.layout.LazyLayoutPrefetchState,androidx.compose.foundation.lazy.layout.LazyLayoutMeasurePolicy)` harness that allows for building custom lazy layouts. LazyLayout and all corresponding APIs are still under development and are subject to change.