# windowInsetsStartWidth

Common/AllAndroid/JVM

## Functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/windowInsetsStartWidth.modifier#(androidx.compose.ui.Modifier).windowInsetsStartWidth(androidx.compose.foundation.layout.WindowInsets)(insets: https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/WindowInsets)` Sets the width to that of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.ui.Modifier).windowInsetsStartWidth(androidx.compose.foundation.layout.WindowInsets)` at the `https://developer.android.com/reference/kotlin/androidx/compose/ui/Alignment#Start()` of the screen, using either `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/WindowInsets#getLeft(androidx.compose.ui.unit.Density,androidx.compose.ui.unit.LayoutDirection)` or `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/WindowInsets#getRight(androidx.compose.ui.unit.Density,androidx.compose.ui.unit.LayoutDirection)`, depending on the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection`. | Cmn |

## Functions

### Modifier.windowInsetsStartWidth

Cmn Artifact: [androidx.compose.foundation:foundation-layout](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/layout/WindowInsetsSize.kt+function:windowInsetsStartWidth) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.2.0)

```
fun Modifier.windowInsetsStartWidth(insets: WindowInsets): Modifier
```

Sets the width to that of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.ui.Modifier).windowInsetsStartWidth(androidx.compose.foundation.layout.WindowInsets)` at the `https://developer.android.com/reference/kotlin/androidx/compose/ui/Alignment#Start()` of the screen, using either `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/WindowInsets#getLeft(androidx.compose.ui.unit.Density,androidx.compose.ui.unit.LayoutDirection)` or `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/WindowInsets#getRight(androidx.compose.ui.unit.Density,androidx.compose.ui.unit.LayoutDirection)`, depending on the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection`.

When used, the android.view.WindowInsets will respect the consumed insets from `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/windowInsetsPadding.modifier#(androidx.compose.ui.Modifier).windowInsetsPadding(androidx.compose.foundation.layout.WindowInsets)` and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/consumeWindowInsets.modifier#(androidx.compose.ui.Modifier).consumeWindowInsets(androidx.compose.foundation.layout.WindowInsets)`, but won't consume any insets.

```kotlin
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.windowInsetsStartWidth
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.core.view.WindowCompat

class SampleActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        WindowCompat.setDecorFitsSystemWindows(window, false)
        super.onCreate(savedInstanceState)
        setContent {
            Box(Modifier.fillMaxSize()) {
                // Background for navigation bar at the start
                Box(
                    Modifier.windowInsetsStartWidth(WindowInsets.navigationBars)
                        .fillMaxHeight()
                        .align(Alignment.CenterStart)
                        .background(Color.Red)
                )
                // app content
            }
        }
    }
}
```