# BasicText

Common/AllAndroid/JVM

## Functions summary

|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/BasicText.composable#BasicText(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)( text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, style: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle, onTextLayout: ((https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, overflow: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextOverflow, softWrap: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, maxLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, minLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ColorProducer?, autoSize: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/TextAutoSize? )` Displays text with semantics and accessibility information. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/BasicText.composable#BasicText(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)( text: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, style: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle, onTextLayout: ((https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, overflow: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextOverflow, softWrap: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, maxLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, minLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, inlineContent: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/InlineTextContent>, color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ColorProducer?, autoSize: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/TextAutoSize? )` Displays text with semantics and accessibility information. | Cmn |

## Functions

### BasicText

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

```
@Composable
fun BasicText(
    text: String,
    modifier: Modifier = Modifier,
    style: TextStyle = TextStyle.Default,
    onTextLayout: ((TextLayoutResult) -> Unit)? = null,
    overflow: TextOverflow = TextOverflow.Clip,
    softWrap: Boolean = true,
    maxLines: Int = Int.MAX_VALUE,
    minLines: Int = 1,
    color: ColorProducer? = null,
    autoSize: TextAutoSize? = null
): Unit
```

Displays text with semantics and accessibility information.

For theme integration, use Material `https://developer.android.com/reference/kotlin/androidx/compose/material3/Text.composable#Text(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.foundation.text.TextAutoSize,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.font.FontStyle,androidx.compose.ui.text.font.FontWeight,androidx.compose.ui.text.font.FontFamily,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextDecoration,androidx.compose.ui.text.style.TextAlign,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.Function1,androidx.compose.ui.text.TextStyle)`.

```kotlin
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.text.BasicText
import androidx.compose.foundation.text.TextAutoSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

Box(modifier = Modifier.size(200.dp)) {
    // The text will find the biggest available font size that fits in the box.
    BasicText(text = "Hello World", autoSize = TextAutoSize.StepBased())
}
```

| Parameters |
|---|---|
| `text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | text to display |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | for this layout |
| `style: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle = TextStyle.Default` | configuration |
| `onTextLayout: ((https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | callback run when a new text layout is calculated. The `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult` parameter contains paragraph information, size, baselines, and other details. Use this callback to add decoration or functionality, such as drawing selection |
| `overflow: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextOverflow = TextOverflow.Clip` | handling visual overflow |
| `softWrap: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | whether to wrap text at soft line breaks. When true, wraps text to the next line when it exceeds layout bounds. When false, positions text as if there was unlimited horizontal space, which may cause it to clip or overflow according to `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)` |
| `maxLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = Int.MAX_VALUE` | maximum number of visible lines. If the text exceeds this value, it is truncated according to `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)` and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)`. Requires 1 \<= `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)`\<= `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)` |
| `minLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 1` | minimum number of visible lines. Requires 1 \<= `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)`\<= `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)` |
| `color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ColorProducer? = null` | to override style color |
| `autoSize: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/TextAutoSize? = null` | configuration for automatic font size adjustment to fit available space. Warning: Auto-sizing runs multiple layout passes and may affect performance. Takes precedence over sizes defined in `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)` |

### BasicText

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

```
@Composable
fun BasicText(
    text: AnnotatedString,
    modifier: Modifier = Modifier,
    style: TextStyle = TextStyle.Default,
    onTextLayout: ((TextLayoutResult) -> Unit)? = null,
    overflow: TextOverflow = TextOverflow.Clip,
    softWrap: Boolean = true,
    maxLines: Int = Int.MAX_VALUE,
    minLines: Int = 1,
    inlineContent: Map<String, InlineTextContent> = mapOf(),
    color: ColorProducer? = null,
    autoSize: TextAutoSize? = null
): Unit
```

Displays text with semantics and accessibility information.

For theme integration, use Material `https://developer.android.com/reference/kotlin/androidx/compose/material3/Text.composable#Text(kotlin.String,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.foundation.text.TextAutoSize,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.font.FontStyle,androidx.compose.ui.text.font.FontWeight,androidx.compose.ui.text.font.FontFamily,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextDecoration,androidx.compose.ui.text.style.TextAlign,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.Function1,androidx.compose.ui.text.TextStyle)`.

```kotlin
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.text.BasicText
import androidx.compose.foundation.text.TextAutoSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

Box(modifier = Modifier.size(200.dp)) {
    // The text will find the biggest available font size that fits in the box.
    BasicText(text = "Hello World", autoSize = TextAutoSize.StepBased())
}
```

| Parameters |
|---|---|
| `text: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/AnnotatedString` | text to display |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | for this layout |
| `style: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextStyle = TextStyle.Default` | configuration |
| `onTextLayout: ((https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | callback run when a new text layout is calculated. The `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextLayoutResult` parameter contains paragraph information, size, baselines, and other details. Use this callback to add decoration or functionality, such as drawing selection |
| `overflow: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/style/TextOverflow = TextOverflow.Clip` | handling visual overflow |
| `softWrap: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | whether to wrap text at soft line breaks. When true, wraps text to the next line when it exceeds layout bounds. When false, positions text as if there was unlimited horizontal space, which may cause it to clip or overflow according to `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)` |
| `maxLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = Int.MAX_VALUE` | maximum number of visible lines. If the text exceeds this value, it is truncated according to `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)` and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)`. Requires 1 \<= `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)`\<= `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)` |
| `minLines: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 1` | minimum number of visible lines. Requires 1 \<= `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)`\<= `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)` |
| `inlineContent: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/InlineTextContent> = mapOf()` | map storing `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/InlineTextContent` composables that replace specified ranges of text, embedding them in the layout |
| `color: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/ColorProducer? = null` | to override style color |
| `autoSize: https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/TextAutoSize? = null` | configuration for automatic font size adjustment to fit available space. Warning: Auto-sizing runs multiple layout passes and may affect performance. Takes precedence over sizes defined in `https://developer.android.com/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,androidx.compose.ui.graphics.ColorProducer,androidx.compose.foundation.text.TextAutoSize)` |