---
title: "requiredSizeIn"
description: "Constrain the width of the content to be between [minWidth]dp and [maxWidth]dp, and the height of
the content to be between [minHeight]dp and [maxHeight]dp. If the content chooses a size that
does not satisfy the incoming [Constraints], the parent layout will be reported a size coerced in
the [Constraints], and the position of the content will be automatically offset to be centered on
the space assigned to the child by the parent layout under the assumption that [Constraints] were
respected."
type: "modifier"
---

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

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


```kotlin
fun Modifier.requiredSizeIn(
    minWidth: Dp = Dp.Unspecified,
    minHeight: Dp = Dp.Unspecified,
    maxWidth: Dp = Dp.Unspecified,
    maxHeight: Dp = Dp.Unspecified,
) =
    this.then(
        SizeElement(
            minWidth = minWidth,
            minHeight = minHeight,
            maxWidth = maxWidth,
            maxHeight = maxHeight,
            enforceIncoming = false,
            inspectorInfo =
                debugInspectorInfo {
                    name = "requiredSizeIn"
                    properties["minWidth"] = minWidth
                    properties["minHeight"] = minHeight
                    properties["maxWidth"] = maxWidth
                    properties["maxHeight"] = maxHeight
                },
        )
    )
```


Constrain the width of the content to be between `minWidth`dp and `maxWidth`dp, and the height of
the content to be between `minHeight`dp and `maxHeight`dp. If the content chooses a size that
does not satisfy the incoming `Constraints`, the parent layout will be reported a size coerced in
the `Constraints`, and the position of the content will be automatically offset to be centered on
the space assigned to the child by the parent layout under the assumption that `Constraints` were
respected.



