Text

Text

A component for displaying text with various styles and configurations.


You can define your own typography after setting up the theme.

Installation

./gradlew lumo --add Text

Usage

Basic Text

Text(
    text = "Hello World",
    style = AppTheme.typography.body1
)

Styled Text

Text(
    text = "Styled Text",
    color = AppTheme.colors.primary,
    fontSize = 20.sp,
    fontWeight = FontWeight.Bold,
    textAlign = TextAlign.Center,
    maxLines = 2,
    overflow = TextOverflow.Ellipsis
)

Resource Text

Text(
    textRes = R.string.welcome_message,
    style = AppTheme.typography.h1
)

API Documentation

Parameters

ParameterTypeDescription
textStringText to display
textRes@StringRes IntString resource ID
modifierModifierModifier for the text
colorColorText color
fontSizeTextUnitSize of the text
fontStyleFontStyle?Style of the font
fontWeightFontWeight?Weight of the font
fontFamilyFontFamily?Font family to use
letterSpacingTextUnitSpacing between letters
textDecorationTextDecoration?Text decoration style
textAlignTextAlignText alignment
lineHeightTextUnitHeight of each line
overflowTextOverflowHow to handle text overflow
softWrapBooleanWhether to wrap text
maxLinesIntMaximum number of lines
minLinesIntMinimum number of lines
styleTextStyleText style to apply