# TextAlign

Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/style/TextAlign.kt+class:androidx.compose.ui.text.style.TextAlign) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  value class TextAlign
  ```

*** ** * ** ***

Aligns text horizontally within its container.

## Summary

| ### Public companion functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#valueOf(kotlin.Int)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` from `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign.Companion#valueOf(kotlin.Int)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign>` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#values()()` Return a list containing all possible values of TextAlign. | Cmn |

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#Center()` Aligns text to the center. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#End()` Aligns text to the trailing edge. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#Justify()` Stretches lines of text to fill the container width. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#Left()` Aligns text to the left edge. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#Right()` Aligns text to the right edge. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#Start()` Aligns text to the leading edge. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#Unspecified()` Represents an unset `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` value. | Cmn |

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#value()` internal integer representation of the text alignment. | Cmn |

| ### Extension functions |
|---|---|---|
| `inline https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign.https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#(androidx.compose.ui.text.style.TextAlign).takeOrElse(kotlin.Function0)(block: () -> https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign)` If `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/package-summary#(androidx.compose.ui.graphics.Color).isSpecified()` is true then this is returned, otherwise `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/package-summary#(androidx.compose.ui.text.style.TextAlign).takeOrElse(kotlin.Function0)` is executed and its result is returned. | Cmn |

| ### Extension properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign.https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#(androidx.compose.ui.text.style.TextAlign).isSpecified()` Returns `true` if this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` is not `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#Unspecified()`. | Cmn |

## Public companion functions

### valueOf

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
fun valueOf(value: Int): TextAlign
```

Creates `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` from `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign.Companion#valueOf(kotlin.Int)`.

Useful for serialization/deserialization.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | internal integer representation. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign.Companion#valueOf(kotlin.Int)` is invalid. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#value()` |   |

### values

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

```
fun values(): List<TextAlign>
```

Return a list containing all possible values of TextAlign.

## Public companion properties

### Center

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

```
val Center: TextAlign
```

Aligns text to the center.

### End

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

```
val End: TextAlign
```

Aligns text to the trailing edge.

Maps to the right edge for LTR, and the left edge for RTL.

### Justify

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

```
val Justify: TextAlign
```

Stretches lines of text to fill the container width.

Lines ending with hard line breaks align to `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#Start()`.

### Left

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

```
val Left: TextAlign
```

Aligns text to the left edge.

### Right

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

```
val Right: TextAlign
```

Aligns text to the right edge.

### Start

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

```
val Start: TextAlign
```

Aligns text to the leading edge.

Maps to the left edge for LTR, and the right edge for RTL.

### Unspecified

Cmn Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0)

```
val Unspecified: TextAlign
```

Represents an unset `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` value.

## Public functions

### toString

Cmn

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

## Public properties

### value

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.10.0)

```
val value: Int
```

internal integer representation of the text alignment.

## Extension functions

### TextAlign.takeOrElse

Cmn Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/style/TextAlign.kt+function:takeOrElse)

```
inline fun TextAlign.takeOrElse(block: () -> TextAlign): TextAlign
```

If `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/package-summary#(androidx.compose.ui.graphics.Color).isSpecified()` is true then this is returned, otherwise `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/package-summary#(androidx.compose.ui.text.style.TextAlign).takeOrElse(kotlin.Function0)` is executed and its result is returned.

## Extension properties

### TextAlign.isSpecified

Cmn Artifact: [androidx.compose.ui:ui-text](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/text/style/TextAlign.kt+symbol:isSpecified)

```
val TextAlign.isSpecified: Boolean
```

Returns `true` if this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign` is not `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#Unspecified()`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextAlign#Unspecified()` |   |