# LazyStaggeredGridScope

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/staggeredgrid/LazyStaggeredGridDsl.kt+class:androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridScope) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.3.0) Common/All
- Cmn

  ```
  sealed interface LazyStaggeredGridScope
  ```

*** ** * ** ***

Receiver scope for `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyVerticalStaggeredGrid.composable#LazyVerticalStaggeredGrid(androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.ui.unit.Dp,androidx.compose.foundation.layout.Arrangement.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.compose.foundation.OverscrollEffect,androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow,kotlin.Function1)` and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyHorizontalStaggeredGrid.composable#LazyHorizontalStaggeredGrid(androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.unit.Dp,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.compose.foundation.OverscrollEffect,androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow,kotlin.Function1)`

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope#item(kotlin.Any,kotlin.Any,androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridItemSpan,kotlin.Function1)( key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, contentType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, span: https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan?, content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add a single item to the staggered grid. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope#items(kotlin.Int,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function2)( count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, key: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)?, contentType: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, span: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan)?, itemContent: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope#items(kotlin.Int,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function2)` of items to the staggered grid. | Cmn |

| ### Extension functions |
|---|---|---|
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope#(androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridScope).items(kotlin.Array,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function2)( items: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<T>, noinline key: ((item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)?, crossinline contentType: (item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, noinline span: ((item) -> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan)?, crossinline itemContent: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.(item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add an array of items to the staggered grid. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope#(androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridScope).items(kotlin.collections.List,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function2)( items: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<T>, noinline key: ((item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)?, crossinline contentType: (item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, noinline span: ((item) -> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan)?, crossinline itemContent: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.(item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add a list of items to the staggered grid. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope#(androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridScope).itemsIndexed(kotlin.Array,kotlin.Function2,kotlin.Function2,kotlin.Function2,kotlin.Function3)( items: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<T>, noinline key: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)?, crossinline contentType: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, noinline span: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan)?, crossinline itemContent: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add an array of items with index-aware content to the staggered grid. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope#(androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridScope).itemsIndexed(kotlin.collections.List,kotlin.Function2,kotlin.Function2,kotlin.Function2,kotlin.Function3)( items: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<T>, noinline key: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)?, crossinline contentType: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, noinline span: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan)?, crossinline itemContent: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Add a list of items with index-aware content to the staggered grid. | Cmn |

## Public functions

### item

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

```
fun item(
    key: Any? = null,
    contentType: Any? = null,
    span: StaggeredGridItemSpan? = null,
    content: @Composable LazyStaggeredGridItemScope.() -> Unit
): Unit
```

Add a single item to the staggered grid.

| Parameters |
|---|---|
| `key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html? = null` | a stable and unique key representing the item. The key MUST be saveable via Bundle on Android. If set to null (by default), the position of the item will be used as a key instead. Using the same key for multiple items in the staggered grid is not allowed. This can be overridden by calling `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState#requestScrollToItem(kotlin.Int,kotlin.Int)`. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. |
| `contentType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html? = null` | a content type representing the item. Content for item of the same type can be reused more efficiently. null is a valid type as well and items of such type will be considered compatible. |
| `span: https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan? = null` | a custom span for this item. Spans configure how many lanes defined by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridCells` the item will occupy. By default each item will take one lane. |
| `content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | composable content displayed by current item |

### items

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

```
fun items(
    count: Int,
    key: ((index: Int) -> Any)? = null,
    contentType: (index: Int) -> Any? = { null },
    span: ((index: Int) -> StaggeredGridItemSpan)? = null,
    itemContent: @Composable LazyStaggeredGridItemScope.(index: Int) -> Unit
): Unit
```

Add a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridScope#items(kotlin.Int,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function2)` of items to the staggered grid.

| Parameters |
|---|---|
| `count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | number of items to add. |
| `key: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)? = null` | a factory of stable and unique keys representing the item. The key MUST be saveable via Bundle on Android. If set to null (by default), the position of the item will be used as a key instead. Using the same key for multiple items in the staggered grid is not allowed. This can be overridden by calling `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState#requestScrollToItem(kotlin.Int,kotlin.Int)`. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. |
| `contentType: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html? = { null }` | a factory of content types representing the item. Content for item of the same type can be reused more efficiently. null is a valid type as well and items of such type will be considered compatible. |
| `span: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan)? = null` | a factory of custom spans for this item. Spans configure how many lanes defined by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridCells` the item will occupy. By default each item will take one lane. |
| `itemContent: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | composable content displayed by item on provided position |

## Extension functions

### LazyStaggeredGridScope.items

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/staggeredgrid/LazyStaggeredGridDsl.kt+function:items)

```
inline fun <T : Any?> LazyStaggeredGridScope.items(
    items: Array<T>,
    noinline key: ((item) -> Any)? = null,
    crossinline contentType: (item) -> Any? = { null },
    noinline span: ((item) -> StaggeredGridItemSpan)? = null,
    crossinline itemContent: @Composable LazyStaggeredGridItemScope.(item) -> Unit
): Unit
```

Add an array of items to the staggered grid.

| Parameters |
|---|---|
| `items: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<T>` | a data array to present |
| `noinline key: ((item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)? = null` | a factory of stable and unique keys representing the item. The key MUST be saveable via Bundle on Android. If set to null (by default), the position of the item will be used as a key instead. Using the same key for multiple items in the staggered grid is not allowed. This can be overridden by calling `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState#requestScrollToItem(kotlin.Int,kotlin.Int)`. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. |
| `crossinline contentType: (item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html? = { null }` | a factory of content types representing the item. Content for item of the same type can be reused more efficiently. null is a valid type as well and items of such type will be considered compatible. |
| `noinline span: ((item) -> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan)? = null` | a factory of custom spans for this item. Spans configure how many lanes defined by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridCells` the item will occupy. By default each item will take one lane. |
| `crossinline itemContent: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.(item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | composable content displayed by the provided item |

### LazyStaggeredGridScope.items

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/staggeredgrid/LazyStaggeredGridDsl.kt+function:items)

```
inline fun <T : Any?> LazyStaggeredGridScope.items(
    items: List<T>,
    noinline key: ((item) -> Any)? = null,
    crossinline contentType: (item) -> Any? = { null },
    noinline span: ((item) -> StaggeredGridItemSpan)? = null,
    crossinline itemContent: @Composable LazyStaggeredGridItemScope.(item) -> Unit
): Unit
```

Add a list of items to the staggered grid.

| Parameters |
|---|---|
| `items: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<T>` | a data list to present |
| `noinline key: ((item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)? = null` | a factory of stable and unique keys representing the item. The key MUST be saveable via Bundle on Android. If set to null (by default), the position of the item will be used as a key instead. Using the same key for multiple items in the staggered grid is not allowed. This can be overridden by calling `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState#requestScrollToItem(kotlin.Int,kotlin.Int)`. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. |
| `crossinline contentType: (item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html? = { null }` | a factory of content types representing the item. Content for item of the same type can be reused more efficiently. null is a valid type as well and items of such type will be considered compatible. |
| `noinline span: ((item) -> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan)? = null` | a factory of custom spans for this item. Spans configure how many lanes defined by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridCells` the item will occupy. By default each item will take one lane. |
| `crossinline itemContent: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.(item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | composable content displayed by the provided item |

### LazyStaggeredGridScope.itemsIndexed

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/staggeredgrid/LazyStaggeredGridDsl.kt+function:itemsIndexed)

```
inline fun <T : Any?> LazyStaggeredGridScope.itemsIndexed(
    items: Array<T>,
    noinline key: ((index: Int, item) -> Any)? = null,
    crossinline contentType: (index: Int, item) -> Any? = { _, _ -> null },
    noinline span: ((index: Int, item) -> StaggeredGridItemSpan)? = null,
    crossinline itemContent: @Composable LazyStaggeredGridItemScope.(index: Int, item) -> Unit
): Unit
```

Add an array of items with index-aware content to the staggered grid.

| Parameters |
|---|---|
| `items: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<T>` | a data array to present |
| `noinline key: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)? = null` | a factory of stable and unique keys representing the item. The key MUST be saveable via Bundle on Android. If set to null (by default), the position of the item will be used as a key instead. Using the same key for multiple items in the staggered grid is not allowed. This can be overridden by calling `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState#requestScrollToItem(kotlin.Int,kotlin.Int)`. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. |
| `crossinline contentType: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html? = { _, _ -> null }` | a factory of content types representing the item. Content for item of the same type can be reused more efficiently. null is a valid type as well and items of such type will be considered compatible. |
| `noinline span: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan)? = null` | a factory of custom spans for this item. Spans configure how many lanes defined by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridCells` the item will occupy. By default each item will take one lane. |
| `crossinline itemContent: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | composable content displayed given item and index |

### LazyStaggeredGridScope.itemsIndexed

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/staggeredgrid/LazyStaggeredGridDsl.kt+function:itemsIndexed)

```
inline fun <T : Any?> LazyStaggeredGridScope.itemsIndexed(
    items: List<T>,
    noinline key: ((index: Int, item) -> Any)? = null,
    crossinline contentType: (index: Int, item) -> Any? = { _, _ -> null },
    noinline span: ((index: Int, item) -> StaggeredGridItemSpan)? = null,
    crossinline itemContent: @Composable LazyStaggeredGridItemScope.(index: Int, item) -> Unit
): Unit
```

Add a list of items with index-aware content to the staggered grid.

| Parameters |
|---|---|
| `items: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<T>` | a data list to present |
| `noinline key: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)? = null` | a factory of stable and unique keys representing the item. The key MUST be saveable via Bundle on Android. If set to null (by default), the position of the item will be used as a key instead. Using the same key for multiple items in the staggered grid is not allowed. This can be overridden by calling `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState#requestScrollToItem(kotlin.Int,kotlin.Int)`. When you specify the key the scroll position will be maintained based on the key, which means if you add/remove items before the current visible item the item with the given key will be kept as the first visible one. |
| `crossinline contentType: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html? = { _, _ -> null }` | a factory of content types representing the item. Content for item of the same type can be reused more efficiently. null is a valid type as well and items of such type will be considered compatible. |
| `noinline span: ((index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridItemSpan)? = null` | a factory of custom spans for this item. Spans configure how many lanes defined by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/StaggeredGridCells` the item will occupy. By default each item will take one lane. |
| `crossinline itemContent: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemScope.(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, item) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | composable content displayed given item and index |