---
title: "asPaddingValues"
description: "Convert a [WindowInsets] to a [PaddingValues] and uses [density] for DP to pixel conversion.
[PaddingValues] can be passed to some containers to pad internal content so that it doesn't
overlap the insets when fully scrolled. Ensure that the insets are
[consumed][consumeWindowInsets] after the padding is applied if insets are to be used further
down the hierarchy."
type: "function"
---

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


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun WindowInsets.asPaddingValues(density: Density): PaddingValues
```


Convert a `WindowInsets` to a `PaddingValues` and uses `density` for DP to pixel conversion.
`PaddingValues` can be passed to some containers to pad internal content so that it doesn't
overlap the insets when fully scrolled. Ensure that the insets are
`consumed` after the padding is applied if insets are to be used further
down the hierarchy.



## Code Examples
### paddingValuesSample
```kotlin
fun paddingValuesSample() {
    class SampleActivity : ComponentActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            WindowCompat.setDecorFitsSystemWindows(window, false)
            super.onCreate(savedInstanceState)
            setContent {
                LazyColumn(contentPadding = WindowInsets.navigationBars.asPaddingValues()) {
                    // items
                }
            }
        }
    }
}
```

