# androidx.xr.compose.unit

## Classes

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/DpVolumeOffset` | Represents the offset of an object in 3D space. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/DpVolumeSize` | Represents the size of a volume in density-independent pixels (`https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp`). |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/IntVolumeOffset` | Represents the offset of an object in 3D space. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/IntVolumeSize` | Represents the size of a volume in pixels. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` | Defines constraints for a 3D volume, specifying minimum and maximum values for width, height, and depth. |

## Annotations

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/ExperimentalSpatialVolumeOffsetApi` | Marks the Spatial Volume Offset APIs as experimental. |

## Extension functions summary

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints.https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/package-summary#(androidx.xr.compose.unit.VolumeConstraints).constrain(androidx.xr.compose.unit.VolumeConstraints)(otherConstraints: https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints)` Constrains the dimensions of this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object to fit within the bounds of the other `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints.https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/package-summary#(androidx.xr.compose.unit.VolumeConstraints).constrainDepth(kotlin.Int)(depth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Constrains a given depth value to fit within the bounds of this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints.https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/package-summary#(androidx.xr.compose.unit.VolumeConstraints).constrainHeight(kotlin.Int)(height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Constrains a given height value to fit within the bounds of this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints.https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/package-summary#(androidx.xr.compose.unit.VolumeConstraints).constrainWidth(kotlin.Int)(width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Constrains a given `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/package-summary#(androidx.xr.compose.unit.VolumeConstraints).constrainWidth(kotlin.Int)` value to fit within the bounds of this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints.https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/package-summary#(androidx.xr.compose.unit.VolumeConstraints).offset(kotlin.Int,kotlin.Int,kotlin.Int)(horizontal: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, vertical: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, depth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates a new `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object by offsetting the minimum and maximum values of this one. |

## Extension functions

### VolumeConstraints.constrain

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/unit/VolumeConstraints.kt+function:constrain) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
fun VolumeConstraints.constrain(otherConstraints: VolumeConstraints): VolumeConstraints
```

Constrains the dimensions of this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object to fit within the bounds of the other `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object.

| Parameters |
|---|---|
| `otherConstraints: https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` | the other `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` to constrain against. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` | a new `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object with dimensions constrained within the bounds of `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/package-summary#(androidx.xr.compose.unit.VolumeConstraints).constrain(androidx.xr.compose.unit.VolumeConstraints)`. |

### VolumeConstraints.constrainDepth

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/unit/VolumeConstraints.kt+function:constrainDepth) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
fun VolumeConstraints.constrainDepth(depth: Int): Int
```

Constrains a given depth value to fit within the bounds of this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object.

| Parameters |
|---|---|
| `depth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the depth value to constrain. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the constrained depth value, ensuring it's within the minimum and maximum depth bounds. |

### VolumeConstraints.constrainHeight

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/unit/VolumeConstraints.kt+function:constrainHeight) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
fun VolumeConstraints.constrainHeight(height: Int): Int
```

Constrains a given height value to fit within the bounds of this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object.

| Parameters |
|---|---|
| `height: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the height value to constrain. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the constrained height value, ensuring it's within the minimum and maximum height bounds. |

### VolumeConstraints.constrainWidth

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/unit/VolumeConstraints.kt+function:constrainWidth) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
fun VolumeConstraints.constrainWidth(width: Int): Int
```

Constrains a given `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/package-summary#(androidx.xr.compose.unit.VolumeConstraints).constrainWidth(kotlin.Int)` value to fit within the bounds of this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object.

| Parameters |
|---|---|
| `width: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the width value to constrain. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the constrained width value, ensuring it's within the minimum and maximum width bounds. |

### VolumeConstraints.offset

Artifact: [androidx.xr.compose:compose](https://developer.android.com/jetpack/androidx/releases/xr-compose) [View Source](https://cs.android.com/search?q=file:androidx/xr/compose/unit/VolumeConstraints.kt+function:offset) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
fun VolumeConstraints.offset(horizontal: Int = 0, vertical: Int = 0, depth: Int = 0): VolumeConstraints
```

Creates a new `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object by offsetting the minimum and maximum values of this one.

| Parameters |
|---|---|
| `horizontal: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the horizontal offset to apply. |
| `vertical: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the vertical offset to apply. |
| `depth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | the depth offset to apply. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` | a new `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object with offset values. |