# SpatialAlignment.Horizontal

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


```
interface SpatialAlignment.Horizontal
```

<br />

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

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialBiasAbsoluteAlignment.Horizontal` | Creates a weighted alignment that specifies a horizontal bias and independent of layout direction |
| `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialBiasAlignment.Horizontal` | Creates a weighted alignment that specifies a horizontal bias. |

*** ** * ** ***

An interface to calculate the alignment of a box of a certain size inside an available width.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/xr/compose/subspace/layout/SpatialAlignment.Horizontal#align(kotlin.Int,kotlin.Int,androidx.compose.ui.unit.LayoutDirection)(size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, space: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, layoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection)` Provides the horizontal alignment offset from the origin of the space to the origin of the content. |

## 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: Int, space: Int, layoutDirection: LayoutDirection): Int
```

Provides the horizontal alignment offset from the origin of the space to the origin of the content.

| Parameters |
|---|---|
| `size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The content size in pixels. |
| `space: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The available space in pixels. |
| `layoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection` | LTR or RTL. |