# Measurable

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/layout/Measurable.kt+class:androidx.compose.ui.layout.Measurable) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface Measurable : IntrinsicMeasurable
  ```

*** ** * ** ***

A part of the composition that can be measured. This represents a layout. The instance should never be stored.

## Summary

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Placeable` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable#measure(androidx.compose.ui.unit.Constraints)(constraints: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints)` Measures the layout with `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable#measure(androidx.compose.ui.unit.Constraints)`, returning a `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Placeable` layout that has its new size. | Cmn |

| ### Extension properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable.https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable#(androidx.compose.ui.layout.Measurable).constraintLayoutId()` | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable.https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable#(androidx.compose.ui.layout.Measurable).constraintLayoutTag()` | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable.https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable#(androidx.compose.ui.layout.Measurable).layoutId()` Retrieves the tag associated to a composable with the `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/layoutId.modifier#(androidx.compose.ui.Modifier).layoutId(kotlin.Any)` modifier. | Cmn |

### Inherited functions

From [androidx.compose.ui.layout.IntrinsicMeasurable](https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/IntrinsicMeasurable) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/IntrinsicMeasurable#maxIntrinsicHeight(kotlin.Int)(width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Calculates the smallest height beyond which increasing the height never decreases the width.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/IntrinsicMeasurable#maxIntrinsicWidth(kotlin.Int)(height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Calculates the smallest width beyond which increasing the width never decreases the height.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/IntrinsicMeasurable#minIntrinsicHeight(kotlin.Int)(width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Calculates the minimum height that the layout can be such that the content of the layout will be painted correctly.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/IntrinsicMeasurable#minIntrinsicWidth(kotlin.Int)(height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Calculates the minimum width that the layout can be such that the content of the layout will be painted correctly.
Cmn

### Inherited properties

From [androidx.compose.ui.layout.IntrinsicMeasurable](https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/IntrinsicMeasurable) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/IntrinsicMeasurable#parentData()`

Data provided by the `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ParentDataModifier`.
Cmn

## Public functions

### measure

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun measure(constraints: Constraints): Placeable
```

Measures the layout with `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable#measure(androidx.compose.ui.unit.Constraints)`, returning a `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Placeable` layout that has its new size. A `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/Measurable` can only be measured once inside a layout pass.

## Extension properties

### Measurable.constraintLayoutId

android Artifact: [androidx.constraintlayout:constraintlayout-compose](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/compose/ConstraintLayoutTag.kt+symbol:constraintLayoutId) Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
val Measurable.constraintLayoutId: Any?
```

### Measurable.constraintLayoutTag

android Artifact: [androidx.constraintlayout:constraintlayout-compose](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/compose/ConstraintLayoutTag.kt+symbol:constraintLayoutTag) Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
val Measurable.constraintLayoutTag: Any?
```

### Measurable.layoutId

Cmn Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/layout/LayoutId.kt+symbol:layoutId) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Measurable.layoutId: Any?
```

Retrieves the tag associated to a composable with the `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/layoutId.modifier#(androidx.compose.ui.Modifier).layoutId(kotlin.Any)` modifier. For a parent data value to be returned by this property when not using the `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/layoutId.modifier#(androidx.compose.ui.Modifier).layoutId(kotlin.Any)` modifier, the parent data value should implement the `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/LayoutIdParentData` interface.

Example usage:

```kotlin
import androidx.compose.foundation.layout.Box
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.layout
import androidx.compose.ui.layout.layoutId
import androidx.compose.ui.unit.Constraints

Layout({
    // Here the Containers are only needed to apply the modifiers. You could use the
    // modifier on header and footer directly if they are composables accepting modifiers.
    Box(Modifier.layoutId("header")) { header() }
    Box(Modifier.layoutId("footer")) { footer() }
}) { measurables, constraints ->
    val placeables = measurables.map { measurable ->
        when (measurable.layoutId) {
            // You should use appropriate constraints. Here we measure fake constraints.
            "header" -> measurable.measure(Constraints.fixed(100, 100))
            "footer" -> measurable.measure(constraints)
            else -> error("Unexpected tag")
        }
    }
    // Size should be derived from children measured sizes on placeables,
    // but this is simplified for the purposes of the example.
    layout(100, 100) { placeables.forEach { it.placeRelative(0, 0) } }
}
```