---
title: "TextAlign"
description: "Defines how to align text horizontally. `TextAlign` controls how text aligns in the space it
appears."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
value class TextAlign internal constructor(val value: Int)
```


Defines how to align text horizontally. `TextAlign` controls how text aligns in the space it
appears.


## Companion Object

#### Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Left = TextAlign(1)
```


Align the text on the left edge of the container.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Right = TextAlign(2)
```


Align the text on the right edge of the container.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Center = TextAlign(3)
```


Align the text in the center of the container.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Justify = TextAlign(4)
```


Stretch lines of text that end with a soft line break to fill the width of the container.

Lines that end with hard line breaks are aligned towards the `Start` edge.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Start = TextAlign(5)
```


Align the text on the leading edge of the container.

For Left to Right text (`ResolvedTextDirection.Ltr`), this is the left edge.

For Right to Left text (`ResolvedTextDirection.Rtl`), like Arabic, this is the right
edge.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val End = TextAlign(6)
```


Align the text on the trailing edge of the container.

For Left to Right text (`ResolvedTextDirection.Ltr`), this is the right edge.

For Right to Left text (`ResolvedTextDirection.Rtl`), like Arabic, this is the left edge.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Unspecified = TextAlign(0)
```


This represents an unset value, a usual replacement for "null" when a primitive value is
desired.



#### Methods

<div class='sourceset sourceset-common'>Common</div>


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


Return a list containing all possible values of TextAlign.



<div class='sourceset sourceset-common'>Common</div>


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


Creates a TextAlign from the given integer value. This can be useful if you need to
serialize/deserialize TextAlign values.

This function throws an `IllegalArgumentException` if the given `value` is not recognized
by the preset `TextAlign` values.

#### Parameters

| | |
| --- | --- |
| value | The integer representation of the TextAlign. |






