---
title: "fillMaxHeight"
description: "Have the content fill (possibly only partially) the [Constraints.maxHeight] of the incoming
measurement constraints, by setting the [minimum height][Constraints.minHeight] and the
[maximum height][Constraints.maxHeight] to be equal to the
[maximum height][Constraints.maxHeight] multiplied by [fraction]. Note that, by default, the
[fraction] is 1, so the modifier will make the content fill the whole available height. If the
incoming maximum height is [Constraints.Infinity] this modifier will have no effect."
type: "modifier"
---

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

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


```kotlin
fun Modifier.fillMaxHeight(@FloatRange(from = 0.0, to = 1.0) fraction: Float = 1f) =
    this.then(if (fraction == 1f) FillWholeMaxHeight else FillElement.height(fraction))
```


Have the content fill (possibly only partially) the `Constraints.maxHeight` of the incoming
measurement constraints, by setting the `minimum height` and the
`maximum height` to be equal to the
`maximum height` multiplied by `fraction`. Note that, by default, the
`fraction` is 1, so the modifier will make the content fill the whole available height. If the
incoming maximum height is `Constraints.Infinity` this modifier will have no effect.

#### Parameters

| | |
| --- | --- |
| fraction | The fraction of the maximum height to use, between `0` and `1`, inclusive. |




## Code Examples
### FillHalfHeightModifier
```kotlin
@Composable
fun FillHalfHeightModifier() {
    Box(Modifier.requiredSize(100.dp).background(Color.Red), contentAlignment = Alignment.Center) {
        // The inner Box will be (30.dp x 50.dp).
        Box(Modifier.requiredWidth(30.dp).fillMaxHeight(0.5f).background(color = Color.Magenta))
    }
}
```
### SimpleFillHeightModifier
```kotlin
@Composable
fun SimpleFillHeightModifier() {
    Box(Modifier.fillMaxHeight().background(Color.Red), contentAlignment = Alignment.Center) {
        Box(Modifier.size(100.dp).background(color = Color.Magenta))
    }
}
```

