# VolumeConstraints

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+class:androidx.xr.compose.unit.VolumeConstraints) Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)


```
class VolumeConstraints
```

<br />

*** ** * ** ***

Defines constraints for a 3D volume, specifying minimum and maximum values for width, height, and depth.

This class is similar in concept to `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Constraints`, but adapted for 3D volumes.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()` Represents an unbounded (infinite) constraint value. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#VolumeConstraints(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int)( minWidth: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, maxWidth: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, minHeight: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, maxHeight: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, minDepth: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, maxDepth: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#copy(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int)( minWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, maxWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, minHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, maxHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, minDepth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, maxDepth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Creates a copy of this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object with modifications to its properties. |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` Checks if this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object is equal to `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#equals(kotlin.Any)` object. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#hashCode()()` Calculates a hash code for this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#toString()()` Returns a string representation of the `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints`. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#hasBoundedDepth()` Indicates whether the depth is bounded (has a maximum value other than `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()`). |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#hasBoundedHeight()` Indicates whether the height is bounded (has a maximum value other than `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()`). |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#hasBoundedWidth()` Indicates whether the width is bounded (has a maximum value other than `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()`). |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#maxDepth()` the maximum allowed depth in pixels. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#maxHeight()` the maximum allowed height in pixels. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#maxWidth()` the maximum allowed width in pixels, use `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()` to indicate no maximum. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#minDepth()` the minimum allowed depth in pixels. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#minHeight()` the minimum allowed height in pixels. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#minWidth()` the minimum allowed width in pixels. |

| ### Extension functions |
|---|---|
| `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/VolumeConstraints#(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/VolumeConstraints#(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/VolumeConstraints#(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/VolumeConstraints#(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/VolumeConstraints#(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. |

## Constants

### INFINITY

```
const val INFINITY: Int
```

Represents an unbounded (infinite) constraint value.

## Public constructors

### VolumeConstraints

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
VolumeConstraints(
    minWidth: @IntRange(from = 0) Int = 0,
    maxWidth: @IntRange(from = 0) Int = INFINITY,
    minHeight: @IntRange(from = 0) Int = 0,
    maxHeight: @IntRange(from = 0) Int = INFINITY,
    minDepth: @IntRange(from = 0) Int = 0,
    maxDepth: @IntRange(from = 0) Int = INFINITY
)
```

## Public functions

### copy

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
fun copy(
    minWidth: Int = this.minWidth,
    maxWidth: Int = this.maxWidth,
    minHeight: Int = this.minHeight,
    maxHeight: Int = this.maxHeight,
    minDepth: Int = this.minDepth,
    maxDepth: Int = this.maxDepth
): VolumeConstraints
```

Creates a copy of this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object with modifications to its properties.

| Parameters |
|---|---|
| `minWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = this.minWidth` | the minimum allowed width in the new constraints. |
| `maxWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = this.maxWidth` | the maximum allowed width in the new constraints. |
| `minHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = this.minHeight` | the minimum allowed height in the new constraints. |
| `maxHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = this.maxHeight` | the maximum allowed height in the new constraints. |
| `minDepth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = this.minDepth` | the minimum allowed depth in the new constraints. |
| `maxDepth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = this.maxDepth` | the maximum allowed depth in the new constraints. |

| 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 the specified modifications. |

### equals

```
open operator fun equals(other: Any?): Boolean
```

Checks if this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object is equal to `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#equals(kotlin.Any)` object.

### hashCode

```
open fun hashCode(): Int
```

Calculates a hash code for this `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints` object.

### toString

```
open fun toString(): String
```

Returns a string representation of the `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints`.

## Public properties

### hasBoundedDepth

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val hasBoundedDepth: Boolean
```

Indicates whether the depth is bounded (has a maximum value other than `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()`).

### hasBoundedHeight

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val hasBoundedHeight: Boolean
```

Indicates whether the height is bounded (has a maximum value other than `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()`).

### hasBoundedWidth

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val hasBoundedWidth: Boolean
```

Indicates whether the width is bounded (has a maximum value other than `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()`).

### maxDepth

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val maxDepth: @IntRange(from = 0) Int
```

the maximum allowed depth in pixels. Can be `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()` to indicate no maximum. Defaults to `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()`.

### maxHeight

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val maxHeight: @IntRange(from = 0) Int
```

the maximum allowed height in pixels. Can be `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()` to indicate no maximum.

### maxWidth

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val maxWidth: @IntRange(from = 0) Int
```

the maximum allowed width in pixels, use `https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/VolumeConstraints#INFINITY()` to indicate no maximum.

### minDepth

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val minDepth: @IntRange(from = 0) Int
```

the minimum allowed depth in pixels. Defaults to 0.

### minHeight

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val minHeight: @IntRange(from = 0) Int
```

the minimum allowed height in pixels.

### minWidth

Added in [1.0.0-beta02](https://developer.android.com/jetpack/androidx/releases/xr-compose#1.0.0-beta02)

```
val minWidth: @IntRange(from = 0) Int
```

the minimum allowed width in pixels.

## 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)

```
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)

```
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)

```
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)

```
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)

```
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. |