by @alexstyl
✉️ Leave your feedback

← Back to Foundation Layout

requiredWidth

Modifier
in
Foundation Layout
. Since 1.0.0

Overview

Examples

Community Notes

Declare the width of the content to be exactly the same as the min or max intrinsic width of the content. The incoming measurement Constraints will not override this value. If the content intrinsic width 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.

See height for options of sizing to intrinsic height. See width and widthIn for options to set the preferred width. See requiredWidth and requiredWidthIn for other options to set the required width.

Overloads

requiredWidth

fun Modifier.requiredWidth(intrinsicSize: IntrinsicSize)

requiredWidth

fun Modifier.requiredWidth(width: Dp)
Next ComponentAlignmentLineOffset