API reference

Text Composable

Displays text using UISet typography and the surrounding semantic content color.

Signature

@Composable
fun Text(
    text: String,
    modifier: Modifier = Modifier,
    color: Color = Color.Unspecified,
    style: TextStyle = LocalTextStyle.current,
    textAlign: TextAlign? = null,
    overflow: TextOverflow = TextOverflow.Clip,
    softWrap: Boolean = true,
    maxLines: Int = Int.MAX_VALUE,
    minLines: Int = 1,
    onTextLayout: (TextLayoutResult) -> Unit? = null,
)

Parameters

text: String text to display
modifier: Modifier modifier applied to the text layout
color: Color explicit text color, or Color.Companion.Unspecified to resolve from style and then the surrounding content color
style: TextStyle typography and drawing attributes for the text
textAlign: TextAlign? horizontal alignment within the text layout, or null to use style
overflow: TextOverflow treatment for text that exceeds its available bounds
softWrap: Boolean whether text may wrap at soft line-break opportunities
maxLines: Int maximum number of visible lines
minLines: Int minimum height expressed as a number of text lines
onTextLayout: ((TextLayoutResult) -> Unit)? optional callback receiving the completed layout result