# LazyItemScope

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

  ```
  @LazyScopeMarker
  interface LazyItemScope
  ```

*** ** * ** ***

Receiver scope being used by the item content parameter of LazyColumn/Row.

## Summary

| ### Public functions |
|---|---|---|
| `open https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).animateItem(androidx.compose.animation.core.FiniteAnimationSpec,androidx.compose.animation.core.FiniteAnimationSpec,androidx.compose.animation.core.FiniteAnimationSpec)( fadeInSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>?, placementSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset>?, fadeOutSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>? )` This modifier animates the item appearance (fade in), disappearance (fade out) and placement changes (such as an item reordering). | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxHeight(kotlin.Float)( fraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Have the content fill the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` of the incoming measurement constraints by setting the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minHeight()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxHeight(kotlin.Float)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxSize(kotlin.Float)( fraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Have the content fill the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` of the parent measurement constraints by setting the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minWidth()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxSize(kotlin.Float)` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minHeight()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxSize(kotlin.Float)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxWidth(kotlin.Float)( fraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Have the content fill the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` of the parent measurement constraints by setting the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minWidth()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxWidth(kotlin.Float)`. | Cmn |

## Public functions

### Modifier.animateItem

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

```
open fun Modifier.animateItem(
    fadeInSpec: FiniteAnimationSpec<Float>? = spring(stiffness = Spring.StiffnessMediumLow),
    placementSpec: FiniteAnimationSpec<IntOffset>? = spring(
                stiffness = Spring.StiffnessMediumLow,
                visibilityThreshold = IntOffset.VisibilityThreshold,
            ),
    fadeOutSpec: FiniteAnimationSpec<Float>? = spring(stiffness = Spring.StiffnessMediumLow)
): Modifier
```

This modifier animates the item appearance (fade in), disappearance (fade out) and placement changes (such as an item reordering).

You should also provide a key via `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListScope#item(kotlin.Any,kotlin.Any,kotlin.Function1)`/`https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListScope#items(kotlin.Int,kotlin.Function1,kotlin.Function1,kotlin.Function2)` for this modifier to enable animations.

```kotlin
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.State
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier

var list by remember { mutableStateOf(listOf("1", "2", "3")) }
Column {
    Button(onClick = { list = list + "${list.count() + 1}" }) { Text("Add new item") }
    Button(onClick = { list = list.shuffled() }) { Text("Shuffle") }
    LazyColumn { items(list, key = { it }) { Text("Item $it", Modifier.animateItem()) } }
}
```

| Parameters |
|---|---|
| `fadeInSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>? = spring(stiffness = Spring.StiffnessMediumLow)` | an animation specs to use for animating the item appearance. When null is provided the item will be appearing without animations. |
| `placementSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntOffset>? = spring( stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntOffset.VisibilityThreshold, )` | an animation specs that will be used to animate the item placement. Aside from item reordering all other position changes caused by events like arrangement or alignment changes will also be animated. When null is provided no animations will happen. |
| `fadeOutSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/FiniteAnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>? = spring(stiffness = Spring.StiffnessMediumLow)` | an animation specs to use for animating the item disappearance. When null is provided the item will be disappearance without animations. |

### Modifier.fillParentMaxHeight

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

```
fun Modifier.fillParentMaxHeight(
    fraction: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f
): Modifier
```

Have the content fill the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` of the incoming measurement constraints by setting the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minHeight()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxHeight(kotlin.Float)`. Note that, by default, the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxHeight(kotlin.Float)` is 1, so the modifier will make the content fill the whole parent height. `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxHeight(kotlin.Float)` must be between `0` and `1`.

Regular `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/fillMaxHeight.modifier#(androidx.compose.ui.Modifier).fillMaxHeight(kotlin.Float)` can't work inside the scrolling vertically layouts as the items are measured with `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#Infinity()` as the constraints for the main axis.

### Modifier.fillParentMaxSize

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

```
fun Modifier.fillParentMaxSize(
    fraction: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f
): Modifier
```

Have the content fill the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` of the parent measurement constraints by setting the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minWidth()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxSize(kotlin.Float)` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minHeight()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxSize(kotlin.Float)`. Note that, by default, the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxSize(kotlin.Float)` is 1, so the modifier will make the content fill the whole available space. `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxSize(kotlin.Float)` must be between `0` and `1`.

Regular `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/fillMaxSize.modifier#(androidx.compose.ui.Modifier).fillMaxSize(kotlin.Float)` can't work inside the scrolling layouts as the items are measured with `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#Infinity()` as the constraints for the main axis.

### Modifier.fillParentMaxWidth

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

```
fun Modifier.fillParentMaxWidth(
    fraction: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f
): Modifier
```

Have the content fill the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` of the parent measurement constraints by setting the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minWidth()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxWidth(kotlin.Float)`. Note that, by default, the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxWidth(kotlin.Float)` is 1, so the modifier will make the content fill the whole parent width. `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyItemScope#(androidx.compose.ui.Modifier).fillParentMaxWidth(kotlin.Float)` must be between `0` and `1`.

Regular `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/fillMaxWidth.modifier#(androidx.compose.ui.Modifier).fillMaxWidth(kotlin.Float)` can't work inside the scrolling horizontally layouts as the items are measured with `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#Infinity()` as the constraints for the main axis.