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

<a id='references'></a>


<h2 id="width-intrinsicsize">width</h2>

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


```kotlin
fun Modifier.width(intrinsicSize: IntrinsicSize) =
    this then
        IntrinsicWidthElement(
            width = intrinsicSize,
            enforceIncoming = true,
            inspectorInfo =
                debugInspectorInfo {
                    name = "width"
                    properties["intrinsicSize"] = intrinsicSize
                },
        )
```


Declare the preferred width of the content to be the same as the min or max intrinsic width of
the content. The incoming measurement `Constraints` may override this value, forcing the content
to be either smaller or larger.

See `height` for options of sizing to intrinsic height. Also see `width` and `widthIn` for other
options to set the preferred width.

Example usage for min intrinsic:


Example usage for max intrinsic:





<hr class="docs-overload-divider">


<h2 id="width-width">width</h2>

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


```kotlin
fun Modifier.width(width: Dp) =
    this.then(
        SizeElement(
            minWidth = width,
            maxWidth = width,
            enforceIncoming = true,
            inspectorInfo =
                debugInspectorInfo {
                    name = "width"
                    value = width
                },
        )
    )
```


Declare the preferred width of the content to be exactly `width`dp. The incoming measurement
`Constraints` may override this value, forcing the content to be either smaller or larger.

For a modifier that sets the width of the content regardless of the incoming constraints see
`Modifier.requiredWidth`. See `height` or `size` to set other preferred dimensions. See
`widthIn`, `heightIn` or `sizeIn` to set a preferred size range.