by @alexstyl
✉️ Leave your feedback

← Back to Compose UI

onSizeChanged

Modifier
in
Compose UI
. Since 1.0.0

Overview

Examples

Community Notes

@Composable
fun OnSizeChangedSample(name: String) {
    // Use onSizeChanged() for diagnostics. Use Layout or SubcomposeLayout if you want
    // to use the size of one component to affect the size of another component.
    Text(
        "Hello $name",
        Modifier.onSizeChanged { size ->
            println("The size of the Text in pixels is $size")
        }
    )
}
Next ComponentAndroidView