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

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

```kotlin
public fun SubspaceModifier.size(size: Dp): SubspaceModifier
```

Declare the preferred size of the content to be exactly a [size](/jetpack-compose/androidx.xr.compose/compose/functions/size) dp cube. When applied to a
Panel, the preferred size will be a [size](/jetpack-compose/androidx.xr.compose/compose/functions/size) dp square instead.

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

<h2 id="size-width-height-depth">size</h2>

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

```kotlin
public fun SubspaceModifier.size(
    width: Dp = Dp.Unspecified,
    height: Dp = Dp.Unspecified,
    depth: Dp = Dp.Unspecified,
): SubspaceModifier
```

Declare the preferred size of the content to be exactly [width](/jetpack-compose/androidx.xr.compose/compose/functions/width) dp along the x dimensions,
[height](/jetpack-compose/androidx.xr.compose/compose/functions/height) dp along the y dimensions, and [depth](/jetpack-compose/androidx.xr.compose/compose/functions/depth) dp along the z dimension.

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

<h2 id="size-size-2">size</h2>

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

```kotlin
public fun SubspaceModifier.size(size: DpVolumeSize): SubspaceModifier
```

Declare the preferred size of the content to be exactly [size](/jetpack-compose/androidx.xr.compose/compose/functions/size) in each of the three dimensions.
Panels have 0 depth and ignore the z-component of this modifier.