🌈 Create new beautiful Compose Gradients with our new wesite ->
Composable Function

BasicText

Displays text with semantics and accessibility information.

BasicText

Source set: Common
@Composable
public 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,
)

Displays text with semantics and accessibility information.

For theme integration, use Material androidx.compose.material3.Text.

Parameters

text text to display
modifier for this layout
style configuration
onTextLayout callback run when a new text layout is calculated. The TextLayoutResult parameter contains paragraph information, size, baselines, and other details. Use this callback to add decoration or functionality, such as drawing selection
overflow handling visual overflow
softWrap 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 overflow
maxLines maximum number of visible lines. If the text exceeds this value, it is truncated according to overflow and softWrap. Requires 1 <= minLines <= maxLines
minLines minimum number of visible lines. Requires 1 <= minLines <= maxLines
color to override style color
autoSize 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 style

BasicText

Source set: Common
@Composable
public 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,
)

Displays text with semantics and accessibility information.

For theme integration, use Material androidx.compose.material3.Text.

Parameters

text text to display
modifier for this layout
style configuration
onTextLayout callback run when a new text layout is calculated. The TextLayoutResult parameter contains paragraph information, size, baselines, and other details. Use this callback to add decoration or functionality, such as drawing selection
overflow handling visual overflow
softWrap 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 overflow
maxLines maximum number of visible lines. If the text exceeds this value, it is truncated according to overflow and softWrap. Requires 1 <= minLines <= maxLines
minLines minimum number of visible lines. Requires 1 <= minLines <= maxLines
inlineContent map storing InlineTextContent composables that replace specified ranges of text, embedding them in the layout
color to override style color
autoSize 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 style

BasicText

Source set: Common
@Deprecated("Maintained for binary compatibility", level = DeprecationLevel.HIDDEN)
@Composable
public 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,
)

Basic element that displays text and provides semantics / accessibility information. Typically you will instead want to use androidx.compose.material.Text, which is a higher level Text element that contains semantics and consumes style information from a theme.

Parameters

text The text to be displayed.
modifier Modifier to apply to this layout node.
style Style configuration for the text such as color, font, line height etc.
onTextLayout Callback that is executed when a new text layout is calculated. A TextLayoutResult object that callback provides contains paragraph information, size of the text, baselines and other details. The callback can be used to add additional decoration or functionality to the text. For example, to draw selection around the text.
overflow How visual overflow should be handled.
softWrap Whether the text should break at soft line breaks. If false, the glyphs in the text will be positioned as if there was unlimited horizontal space. If softWrap is false, overflow and TextAlign may have unexpected effects.
maxLines An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to overflow and softWrap. It is required that 1 <= minLines <= maxLines.
minLines The minimum height in terms of minimum number of visible lines. It is required that 1 <= minLines <= maxLines.
color Overrides the text color provided in style

BasicText

Source set: Common
@Deprecated("Maintained for binary compatibility", level = DeprecationLevel.HIDDEN)
@Composable
public 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,
)

Basic element that displays text and provides semantics / accessibility information. Typically you will instead want to use androidx.compose.material.Text, which is a higher level Text element that contains semantics and consumes style information from a theme.

Parameters

text The text to be displayed.
modifier Modifier to apply to this layout node.
style Style configuration for the text such as color, font, line height etc.
onTextLayout Callback that is executed when a new text layout is calculated. A TextLayoutResult object that callback provides contains paragraph information, size of the text, baselines and other details. The callback can be used to add additional decoration or functionality to the text. For example, to draw selection around the text.
overflow How visual overflow should be handled.
softWrap Whether the text should break at soft line breaks. If false, the glyphs in the text will be positioned as if there was unlimited horizontal space. If softWrap is false, overflow and TextAlign may have unexpected effects.
maxLines An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to overflow and softWrap. It is required that 1 <= minLines <= maxLines.
minLines The minimum height in terms of minimum number of visible lines. It is required that 1 <= minLines <= maxLines.
inlineContent A map store composables that replaces certain ranges of the text. It's used to insert composables into text layout. Check InlineTextContent for more information.
color Overrides the text color provided in style

BasicText

Source set: Common
@Deprecated("Maintained for binary compatibility", level = DeprecationLevel.HIDDEN)
@Composable
public 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,
)

BasicText

Source set: Common
@Deprecated("Maintained for binary compatibility", level = DeprecationLevel.HIDDEN)
@Composable
public 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,
    inlineContent: Map<String, InlineTextContent> = mapOf(),
)

BasicText

Source set: Common
@Deprecated("Maintained for binary compat", level = DeprecationLevel.HIDDEN)
@Composable
public 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,
): Unit

BasicText

Source set: Common
@Deprecated("Maintained for binary compat", level = DeprecationLevel.HIDDEN)
@Composable
public 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(),
): Unit