---
title: "rememberNestedScrollInteropConnection"
description: "Create and [remember] the [NestedScrollConnection] that enables Nested Scroll Interop between a
View parent that implements [androidx.core.view.NestedScrollingParent3] and a Compose child. This
should be used in conjunction with a [androidx.compose.ui.input.nestedscroll.nestedScroll]
modifier. Nested Scroll is enabled by default on the compose side and you can use this connection
to enable both nested scroll on the view side and to add glue logic between View and compose.

Note that this only covers the use case where a cooperating parent is used. A cooperating parent
is one that implements NestedScrollingParent3, a key layout that does that is
[androidx.coordinatorlayout.widget.CoordinatorLayout].


Learn how to enable nested scroll interop:"
type: "composable"
---

<div class='type'>Composable Function</div>


<a id='references'></a>

<div class='sourceset sourceset-android'>Android</div>


```kotlin
@Composable
fun rememberNestedScrollInteropConnection(
    hostView: View = LocalView.current
): NestedScrollConnection
```


Create and `remember` the `NestedScrollConnection` that enables Nested Scroll Interop between a
View parent that implements `androidx.core.view.NestedScrollingParent3` and a Compose child. This
should be used in conjunction with a `androidx.compose.ui.input.nestedscroll.nestedScroll`
modifier. Nested Scroll is enabled by default on the compose side and you can use this connection
to enable both nested scroll on the view side and to add glue logic between View and compose.

Note that this only covers the use case where a cooperating parent is used. A cooperating parent
is one that implements NestedScrollingParent3, a key layout that does that is
`androidx.coordinatorlayout.widget.CoordinatorLayout`.


Learn how to enable nested scroll interop:

#### Parameters

| | |
| --- | --- |
| hostView | The View that hosts the compose scrollable, this is usually a ComposeView. |





## Code Examples
### ComposeInCooperatingViewNestedScrollInteropSample
```kotlin
@Composable
fun ComposeInCooperatingViewNestedScrollInteropSample() {
    val nestedSrollInterop = rememberNestedScrollInteropConnection()
    // Add the nested scroll connection to your top level @Composable element
    // using the nestedScroll modifier.
    LazyColumn(modifier = Modifier.nestedScroll(nestedSrollInterop)) {
        items(20) { item ->
            Box(
                modifier =
                    Modifier.padding(16.dp).height(56.dp).fillMaxWidth().background(Color.Gray),
                contentAlignment = Alignment.Center,
            ) {
                Text(item.toString())
            }
        }
    }
}
```

