# SpatialAlignment

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


```
interface SpatialAlignment
```

<br />

Known direct subclasses [SpatialBiasAbsoluteAlignment](https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialBiasAbsoluteAlignment), [SpatialBiasAlignment](https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialBiasAlignment)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialBiasAbsoluteAlignment` | Positions content in 3D space using horizontal, vertical, and depth bias. |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialBiasAlignment` | Positions content in 3D space using horizontal, vertical, and depth bias. |

*** ** * ** ***

An interface to calculate the position of a sized box inside an available 3D space. `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment` is often used to define the alignment of a layout inside a parent layout.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialBiasAlignment` |   |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAbsoluteAlignment` |   |

## Summary

| ### Nested types |
|---|
| `interface https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Depth` An interface to calculate the alignment of a box of a certain size inside an available depth. |
| `interface https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Horizontal` An interface to calculate the alignment of a box of a certain size inside an available width. |
| `interface https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Vertical` An interface to calculate the alignment of a box of a certain size inside an available height. |

| ### Public companion properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Depth` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#Back()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Vertical` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#Bottom()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#BottomCenter()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#BottomEnd()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#BottomStart()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#Center()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Depth` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#CenterDepthwise()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#CenterEnd()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Horizontal` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#CenterHorizontally()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#CenterStart()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Vertical` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#CenterVertically()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Horizontal` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#End()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Depth` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#Front()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Horizontal` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#Start()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Vertical` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#Top()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#TopCenter()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#TopEnd()` |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#TopStart()` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/runtime/math/Vector3` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment#align(androidx.xr.compose.unit.IntVolumeSize,androidx.xr.compose.unit.IntVolumeSize,androidx.compose.ui.unit.LayoutDirection)( size: https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/IntVolumeSize, space: https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/IntVolumeSize, layoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection )` Provides the origin-based position of the content in the available space. |

## Public companion properties

### Back

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

```
val Back: SpatialAlignment.Depth
```

### Bottom

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

```
val Bottom: SpatialAlignment.Vertical
```

### BottomCenter

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

```
val BottomCenter: SpatialAlignment
```

### BottomEnd

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

```
val BottomEnd: SpatialAlignment
```

### BottomStart

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

```
val BottomStart: SpatialAlignment
```

### Center

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

```
val Center: SpatialAlignment
```

### CenterDepthwise

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

```
val CenterDepthwise: SpatialAlignment.Depth
```

### CenterEnd

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

```
val CenterEnd: SpatialAlignment
```

### CenterHorizontally

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

```
val CenterHorizontally: SpatialAlignment.Horizontal
```

### CenterStart

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

```
val CenterStart: SpatialAlignment
```

### CenterVertically

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

```
val CenterVertically: SpatialAlignment.Vertical
```

### End

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

```
val End: SpatialAlignment.Horizontal
```

### Front

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

```
val Front: SpatialAlignment.Depth
```

### Start

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

```
val Start: SpatialAlignment.Horizontal
```

### Top

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

```
val Top: SpatialAlignment.Vertical
```

### TopCenter

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

```
val TopCenter: SpatialAlignment
```

### TopEnd

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

```
val TopEnd: SpatialAlignment
```

### TopStart

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

```
val TopStart: SpatialAlignment
```

## Public functions

### align

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

```
fun align(
    size: IntVolumeSize,
    space: IntVolumeSize,
    layoutDirection: LayoutDirection
): Vector3
```

Provides the origin-based position of the content in the available space.

| Parameters |
|---|---|
| `size: https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/IntVolumeSize` | The content size in pixels. |
| `space: https://developer.android.com/reference/kotlin/androidx/xr/compose/unit/IntVolumeSize` | The available space in pixels. |
| `layoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection` | LTR or RTL. |