# TextDirection

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/TextDirection.kt+class:androidx.compose.ui.text.style.TextDirection) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  value class TextDirection
  ```

*** ** * ** ***

Defines the algorithm used to determine text direction.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/ResolvedTextDirection` |   |

## Summary

| ### Public companion functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection#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/TextDirection` from `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection.Companion#valueOf(kotlin.Int)`. | Cmn |

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection#Content()` Resolves direction using the first strong directional character according to the Unicode Bidirectional Algorithm. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection#ContentOrLtr()` Resolves direction based on the first strong directional character according to the Unicode Bidirectional Algorithm. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection#ContentOrRtl()` Resolves direction based on the first strong directional character according to the Unicode Bidirectional Algorithm. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection#Ltr()` Sets the text direction to Left-to-Right. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection#Rtl()` Sets the text direction to Right-to-Left. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection#Unspecified()` Represents an unset `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` 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/TextDirection#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/TextDirection#value()` internal integer representation of the text direction. | Cmn |

| ### Extension functions |
|---|---|---|
| `inline https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection.https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection#(androidx.compose.ui.text.style.TextDirection).takeOrElse(kotlin.Function0)(block: () -> https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection)` 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.TextDirection).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/TextDirection.https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection#(androidx.compose.ui.text.style.TextDirection).isSpecified()` Returns `true` if this `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` is not `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection#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): TextDirection
```

Creates `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` from `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection.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/TextDirection.Companion#valueOf(kotlin.Int)` is invalid. |

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

## Public companion properties

### Content

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

```
val Content: TextDirection
```

Resolves direction using the first strong directional character according to the Unicode Bidirectional Algorithm.

If no strong directional characters are present, falls back to `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection`, or to `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/intl/LocaleList` when creating a `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/Paragraph` (ignoring `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection`).

### ContentOrLtr

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

```
val ContentOrLtr: TextDirection
```

Resolves direction based on the first strong directional character according to the Unicode Bidirectional Algorithm.

Falls back to Left-to-Right if no strong directional characters are found.

### ContentOrRtl

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

```
val ContentOrRtl: TextDirection
```

Resolves direction based on the first strong directional character according to the Unicode Bidirectional Algorithm.

Falls back to Right-to-Left if no strong directional characters are found.

### Ltr

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

```
val Ltr: TextDirection
```

Sets the text direction to Left-to-Right.

### Rtl

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

```
val Rtl: TextDirection
```

Sets the text direction to Right-to-Left.

### Unspecified

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

```
val Unspecified: TextDirection
```

Represents an unset `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextDirection` 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 direction.

## Extension functions

### TextDirection.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/TextDirection.kt+function:takeOrElse)

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

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.TextDirection).takeOrElse(kotlin.Function0)` is executed and its result is returned.

## Extension properties

### TextDirection.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/TextDirection.kt+symbol:isSpecified)

```
val TextDirection.isSpecified: Boolean
```

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

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