Android 12 Developer Preview is here! Try it out, and give us your feedback!

TextStyle

@Immutable class TextStyle
kotlin.Any
   ↳ androidx.compose.ui.text.TextStyle

Styling configuration for a Text.

import androidx.compose.material.Text
import androidx.compose.ui.text.TextStyle

Text(
    text = "Demo Text",
    style = TextStyle(
        color = Color.Red,
        fontSize = 16.sp,
        fontFamily = FontFamily.Monospace,
        fontWeight = FontWeight.W800,
        fontStyle = FontStyle.Italic,
        letterSpacing = 0.5.em,
        background = Color.LightGray,
        textDecoration = TextDecoration.Underline
    )
)

Summary

Public constructors
<init>(color: Color = Color.Unspecified, fontSize: TextUnit = TextUnit.Unspecified, fontWeight: FontWeight? = null, fontStyle: FontStyle? = null, fontSynthesis: FontSynthesis? = null, fontFamily: FontFamily? = null, fontFeatureSettings: String? = null, letterSpacing: TextUnit = TextUnit.Unspecified, baselineShift: BaselineShift? = null, textGeometricTransform: TextGeometricTransform? = null, localeList: LocaleList? = null, background: Color = Color.Unspecified, textDecoration: TextDecoration? = null, shadow: Shadow? = null, textAlign: TextAlign? = null, textDirection: TextDirection? = null, lineHeight: TextUnit = TextUnit.Unspecified, textIndent: TextIndent? = null)

Styling configuration for a Text.

Public methods
TextStyle