<h2 id="onsizechanged-onsizechanged">onSizeChanged</h2>

<div class='sourceset sourceset-android'>Android</div>

```kotlin
public fun SubspaceModifier.onSizeChanged(
    onSizeChanged: (size: IntVolumeSize) -> Unit
): SubspaceModifier
```

Invokes `onSizeChanged` with the `IntVolumeSize` of the element when its size changes.

This callback is executed after the layout pass when the SubspaceComposable's size is finalized.
It will be invoked at least once when the size becomes available and subsequently whenever the
size changes.

For observing changes to position or orientation in addition to size, use
[SubspaceModifier.onGloballyPositioned](/jetpack-compose/androidx.xr.compose/compose/functions/onGloballyPositioned) instead.

#### Parameters

| | |
| --- | --- |
| onSizeChanged | The callback that is invoked when the size changes. The [IntVolumeSize](/jetpack-compose/androidx.xr.compose/compose/classes/IntVolumeSize) parameter represents the new size of the layout in pixels. |