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

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

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

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

This is in contrast to [SubspaceModifier.size](/jetpack-compose/androidx.xr.compose/compose/functions/size), which respects the parent's constraints.
`requiredSize` will ignore all min and max constraints from the incoming constraints, which can
be useful for sizing an element to a specific value even if it exceeds the parent's bounds.

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

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

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

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

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

This is in contrast to [SubspaceModifier.size](/jetpack-compose/androidx.xr.compose/compose/functions/size), which respects the parent's constraints.
`requiredSize` will ignore all min and max constraints from the incoming constraints, which can
be useful for sizing an element to a specific value even if it exceeds the parent's bounds. The
parent will then determine how to handle the overflow.

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

<h2 id="requiredsize-width-height-depth">requiredSize</h2>

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

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

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

This is in contrast to [SubspaceModifier.size](/jetpack-compose/androidx.xr.compose/compose/functions/size), which respects the parent's constraints.
`requiredSize` will ignore all min and max constraints from the incoming constraints, which can
be useful for sizing an element to a specific value even if it exceeds the parent's bounds. The
parent will then determine how to handle the overflow.