OudsDisplayText

fun OudsDisplayText(text: String, modifier: Modifier = Modifier, size: OudsDisplayTextSize = OudsDisplayTextDefaults.Size, color: Color = OudsDisplayTextDefaults.Color, textAlign: TextAlign? = null, lineHeight: TextUnit = TextUnit.Unspecified, overflow: TextOverflow = TextOverflow.Clip, softWrap: Boolean = true, maxLines: Int = Int.MAX_VALUE, minLines: Int = 1, onTextLayout: (TextLayoutResult) -> Unit? = null)

Display styles are intended for high-impact content such as landing pages, marketing campaigns, and key messages. Their large type sizes help capture attention and establish strong visual emphasis. Variants automatically adapt across breakpoints to maintain a consistent visual hierarchy on every screen size. Use them sparingly to preserve their impact and effectiveness.

An overload accepting annotated types is available for rich text formatting.

Design

NameDisplay
Version1.0.0

Parameters

text

Text to be displayed.

modifier

Modifier applied to the display text.

size

Size of the display text.

color

Color of the display text.

textAlign

Alignment of the text within the lines of the paragraph. See TextStyle.textAlign.

lineHeight

Line height for the Paragraph in TextUnit unit, e.g. SP or EM. See TextStyle.lineHeight.

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.

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.

Samples

OudsDisplayText(
    modifier = Modifier.padding(OudsTheme.spaces.fixed.small),
    text = "Display",
    size = OudsDisplayTextSize.Medium
)

fun OudsDisplayText(text: OudsAnnotatedDisplayText, modifier: Modifier = Modifier, size: OudsDisplayTextSize = OudsDisplayTextDefaults.Size, color: Color = OudsDisplayTextDefaults.Color, textAlign: TextAlign? = null, lineHeight: TextUnit = TextUnit.Unspecified, overflow: TextOverflow = TextOverflow.Clip, softWrap: Boolean = true, maxLines: Int = Int.MAX_VALUE, minLines: Int = 1, onTextLayout: (TextLayoutResult) -> Unit = {})

Display styles are intended for high-impact content such as landing pages, marketing campaigns, and key messages. Their large type sizes help capture attention and establish strong visual emphasis. Variants automatically adapt across breakpoints to maintain a consistent visual hierarchy on every screen size. Use them sparingly to preserve their impact and effectiveness.

An overload accepting plain text is available for simple text without formatting.

Design

NameDisplay
Version1.0.0

Parameters

text

OudsAnnotatedDisplayText to be displayed.

modifier

Modifier applied to the display text.

size

Size of the display text.

color

Color of the display text.

textAlign

Alignment of the text within the lines of the paragraph. See TextStyle.textAlign.

lineHeight

Line height for the Paragraph in TextUnit unit, e.g. SP or EM. See TextStyle.lineHeight.

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.

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.

Samples

val highlightColor = OudsTheme.colorScheme.content.brandPrimary
OudsDisplayText(
    modifier = Modifier.padding(OudsTheme.spaces.fixed.small),
    text = buildOudsAnnotatedDisplayText {
        append("Label with ")
        withColor(color = highlightColor) { append("highlighted text") }
    },
    size = OudsDisplayTextSize.Small
)