# PinnableContainer

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/PinnableContainer.kt+class:androidx.compose.ui.layout.PinnableContainer) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.4.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface PinnableContainer
  ```

*** ** * ** ***

Represents a container which can be pinned when the content of this container is important.

For example, each item of lazy list represents one `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/PinnableContainer`, and if this container is pinned, this item will not be disposed when scrolled out of the viewport.

Pinning a currently focused item so the focus is not lost is one of the examples when this functionality can be useful.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#LocalPinnableContainer()` |   |

## Summary

| ### Nested types |
|---|
| `fun interface https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/PinnableContainer.PinnedHandle` This is an object returned by `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/PinnableContainer#pin()` which allows to release the pinning. |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/PinnableContainer.PinnedHandle` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/PinnableContainer#pin()()` Allows to pin this container when the associated content is considered important. | Cmn |

## Public functions

### pin

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

```
fun pin(): PinnableContainer.PinnedHandle
```

Allows to pin this container when the associated content is considered important.

For example, if this `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/PinnableContainer` is an item of lazy list pinning will mean this item will not be disposed when scrolled out of the viewport.

Don't forget to call `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/PinnableContainer.PinnedHandle#release()` when this content is not important anymore.