---
title: "consumeWindowInsets"
description: "Consume insets that haven't been consumed yet by other insets Modifiers similar to
[windowInsetsPadding] without adding any padding.

This can be useful when content offsets are provided by [WindowInsets.asPaddingValues]. This
should be used further down the hierarchy than the [PaddingValues] is used so that the values
aren't consumed before the padding is added."
type: "modifier"
---

<div class='type'>Compose Modifier</div>

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


```kotlin
fun Modifier.consumeWindowInsets(insets: WindowInsets): Modifier
```


Consume insets that haven't been consumed yet by other insets Modifiers similar to
`windowInsetsPadding` without adding any padding.

This can be useful when content offsets are provided by `WindowInsets.asPaddingValues`. This
should be used further down the hierarchy than the `PaddingValues` is used so that the values
aren't consumed before the padding is added.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun Modifier.consumeWindowInsets(paddingValues: PaddingValues): Modifier
```


Consume `paddingValues` as insets as if the padding was added irrespective of insets. Layouts
further down the hierarchy that use `windowInsetsPadding`, `safeContentPadding`, and other insets
padding Modifiers won't pad for the values that `paddingValues` provides. This can be useful when
content offsets are provided by layout rather than `windowInsetsPadding` modifiers.

This method consumes all of `paddingValues` in addition to whatever has been consumed by other
`windowInsetsPadding` modifiers by ancestors. `consumeWindowInsets` accepting a `WindowInsets`
argument ensures that its insets are consumed and doesn't consume more if they have already been
consumed by ancestors.



## Code Examples
### consumedInsetsPaddingSample
```kotlin
fun consumedInsetsPaddingSample() {
    class SampleActivity : ComponentActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            WindowCompat.setDecorFitsSystemWindows(window, false)
            super.onCreate(savedInstanceState)
            setContent {
                with(LocalDensity.current) {
                    val paddingValues = PaddingValues(horizontal = 20.dp)
                    Box(Modifier.padding(paddingValues).consumeWindowInsets(paddingValues)) {
                        // app content
                    }
                }
            }
        }
    }
}
```
### consumedInsetsSample
```kotlin
fun consumedInsetsSample() {
    class SampleActivity : ComponentActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            WindowCompat.setDecorFitsSystemWindows(window, false)
            super.onCreate(savedInstanceState)
            setContent {
                Box(Modifier.padding(WindowInsets.navigationBars.asPaddingValues())) {
                    Box(Modifier.consumeWindowInsets(WindowInsets.navigationBars)) {
                        // app content
                    }
                }
            }
        }
    }
}
```

