# BeyondBoundsLayout

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/layout/BeyondBoundsLayout.kt+class:androidx.compose.ui.layout.BeyondBoundsLayout) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.2.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface BeyondBoundsLayout
  ```

*** ** * ** ***

Layout extra items in the specified direction.

A `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout` instance can be obtained by searching the tree using DelegatableNode.findNearestBeyondBoundsLayoutAncestor(). It can be used to send a request to layout more items in a particular `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout.LayoutDirection`. This can be useful when composition or layout is determined lazily, as with a LazyColumn. The request is received by any parent up the hierarchy that provides this modifier local.

## Summary

| ### Nested types |
|---|
| `interface https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout.BeyondBoundsScope` The scope used in `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout#layout(androidx.compose.ui.layout.BeyondBoundsLayout.LayoutDirection,kotlin.Function1)`. |
| `value class https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout.LayoutDirection` The direction (from the visible bounds) that a `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout` is requesting more items to be laid. |

| ### Public functions |
|---|---|---|
| `T?` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout#layout(androidx.compose.ui.layout.BeyondBoundsLayout.LayoutDirection,kotlin.Function1)( direction: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout.LayoutDirection, block: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout.BeyondBoundsScope.() -> T? )` Send a request to layout more items in the specified `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout.LayoutDirection`. | Cmn |

## Public functions

### layout

Cmn

```
fun <T : Any?> layout(
    direction: BeyondBoundsLayout.LayoutDirection,
    block: BeyondBoundsLayout.BeyondBoundsScope.() -> T?
): T?
```

Send a request to layout more items in the specified `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout.LayoutDirection`. The request is received by a parent up the hierarchy. The parent adds one item at a time and calls `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout#layout(androidx.compose.ui.layout.BeyondBoundsLayout.LayoutDirection,kotlin.Function1)` after each item is added. The parent continues adding new items as long as `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout#layout(androidx.compose.ui.layout.BeyondBoundsLayout.LayoutDirection,kotlin.Function1)` returns null. Once you have all the items you need, you can perform some operation and return a non-null value. Returning this value stops the laying out of beyond bounds items. (Note that you have to return a non-null value stop iterating).

| Parameters |
|---|---|
| `direction: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout.LayoutDirection` | The direction from the visible bounds in which more items are requested. |
| `block: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout.BeyondBoundsScope.() -> T?` | Continue to layout more items until this block returns a non null item. |

| Returns |
|---|---|
| `T?` | The value returned by the last run of `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout#layout(androidx.compose.ui.layout.BeyondBoundsLayout.LayoutDirection,kotlin.Function1)`. If we layout all the available items then the returned value is null. When this function returns all the beyond bounds items may be disposed. Therefore you have to perform any custom logic within the `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/BeyondBoundsLayout#layout(androidx.compose.ui.layout.BeyondBoundsLayout.LayoutDirection,kotlin.Function1)` and return the value you need. |