# LazyGridLayoutInfo

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

  ```
  sealed interface LazyGridLayoutInfo
  ```

*** ** * ** ***

Contains useful information about the currently displayed layout state of lazy grids like `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyVerticalGrid.composable#LazyVerticalGrid(androidx.compose.foundation.lazy.grid.GridCells,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.grid.LazyGridState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,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)`. For example you can get the list of currently displayed items.

Use `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridState#layoutInfo()` to retrieve this

## Summary

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#afterContentPadding()` The content padding in pixels applied after the last row/column in the direction of scrolling. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#beforeContentPadding()` The content padding in pixels applied before the first row/column in the direction of scrolling. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#mainAxisItemSpacing()` The spacing between lines in the direction of scrolling. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#maxSpan()` The max line span an item can occupy. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/Orientation` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#orientation()` The orientation of the lazy grid. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#reverseLayout()` True if the direction of scrolling and layout is reversed. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#totalItemsCount()` The total count of items passed to `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyVerticalGrid.composable#LazyVerticalGrid(androidx.compose.foundation.lazy.grid.GridCells,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.grid.LazyGridState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,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)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#viewportEndOffset()` The end offset of the layout's viewport in pixels. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/IntSize` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#viewportSize()` The size of the viewport in pixels. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#viewportStartOffset()` The start offset of the layout's viewport in pixels. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemInfo>` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#visibleItemsInfo()` The list of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemInfo` representing all the currently visible items. | Cmn |

## Public properties

### afterContentPadding

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

```
val afterContentPadding: Int
```

The content padding in pixels applied after the last row/column in the direction of scrolling. For example it is a bottom content padding for LazyVerticalGrid with reverseLayout set to false.

### beforeContentPadding

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

```
val beforeContentPadding: Int
```

The content padding in pixels applied before the first row/column in the direction of scrolling. For example it is a top content padding for LazyVerticalGrid with reverseLayout set to false.

### mainAxisItemSpacing

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

```
val mainAxisItemSpacing: Int
```

The spacing between lines in the direction of scrolling.

### maxSpan

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

```
val maxSpan: Int
```

The max line span an item can occupy. This will be the number of columns in vertical grids or the number of rows in horizontal grids.

For example if `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyVerticalGrid.composable#LazyVerticalGrid(androidx.compose.foundation.lazy.grid.GridCells,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.grid.LazyGridState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,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)` has 3 columns this value will be 3 for each cell.

### orientation

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

```
val orientation: Orientation
```

The orientation of the lazy grid.

### reverseLayout

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

```
val reverseLayout: Boolean
```

True if the direction of scrolling and layout is reversed.

### totalItemsCount

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

```
val totalItemsCount: Int
```

The total count of items passed to `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyVerticalGrid.composable#LazyVerticalGrid(androidx.compose.foundation.lazy.grid.GridCells,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.grid.LazyGridState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,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)`.

### viewportEndOffset

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

```
val viewportEndOffset: Int
```

The end offset of the layout's viewport in pixels. You can think of it as a maximum offset which would be visible. It is the size of the lazy grid layout minus `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#beforeContentPadding()`.

You can use it to understand what items from `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#visibleItemsInfo()` are fully visible.

### viewportSize

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

```
val viewportSize: IntSize
```

The size of the viewport in pixels. It is the lazy grid layout size including all the content paddings.

### viewportStartOffset

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

```
val viewportStartOffset: Int
```

The start offset of the layout's viewport in pixels. You can think of it as a minimum offset which would be visible. Usually it is 0, but it can be negative if non-zero `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#beforeContentPadding()` was applied as the content displayed in the content padding area is still visible.

You can use it to understand what items from `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridLayoutInfo#visibleItemsInfo()` are fully visible.

### visibleItemsInfo

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

```
val visibleItemsInfo: List<LazyGridItemInfo>
```

The list of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemInfo` representing all the currently visible items.