# fillMaxSize

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/fillMaxSize.modifier#(androidx.compose.ui.Modifier).fillMaxSize(kotlin.Float)(fraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Have the content fill (possibly only partially) the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` of the incoming measurement constraints, by setting the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minWidth()` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.ui.Modifier).fillMaxSize(kotlin.Float)`, as well as the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minHeight()` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minHeight()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.ui.Modifier).fillMaxSize(kotlin.Float)`. | Cmn |

## Functions

### Modifier.fillMaxSize

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/Size.kt+function:fillMaxSize) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0)

```
fun Modifier.fillMaxSize(fraction: @FloatRange(from = 0.0, to = 1.0) Float = 1.0f): Modifier
```

Have the content fill (possibly only partially) the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` of the incoming measurement constraints, by setting the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minWidth()` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxWidth()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.ui.Modifier).fillMaxSize(kotlin.Float)`, as well as the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minHeight()` and the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#minHeight()` to be equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#maxHeight()` multiplied by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.ui.Modifier).fillMaxSize(kotlin.Float)`. Note that, by default, the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.ui.Modifier).fillMaxSize(kotlin.Float)` is 1, so the modifier will make the content fill the whole available space. If the incoming maximum width or height is `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints#Infinity()` this modifier will have no effect in that dimension.

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Box(Modifier.fillMaxSize().background(Color.Red), contentAlignment = Alignment.Center) {
    Box(Modifier.size(100.dp).background(color = Color.Magenta))
}
```

```kotlin
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.layout.requiredWidth
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

Box(Modifier.requiredSize(100.dp).background(Color.Red), contentAlignment = Alignment.Center) {
    // The inner Box will be (50.dp x 50.dp).
    Box(Modifier.requiredWidth(30.dp).fillMaxSize(0.5f).background(color = Color.Magenta))
}
```

| Parameters |
|---|---|
| `fraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 1.0f` | The fraction of the maximum size to use, between `0` and `1`, inclusive. Example usage: |