Text in Compose
Stay organized with collections
Save and categorize content based on your preferences.
Text is a central piece of any UI, and Jetpack Compose makes it easier to
display or write text. Compose leverages composition of its building blocks,
meaning you don’t need to overwrite properties and methods or extend big classes
to have a specific composable design and logic working the way you want.
As its base, Compose provides a BasicText
and BasicTextField
,
which are the barebones to display text and handle user input. At a higher
level, Compose provides Text
and TextField
,
which are composables following Material Design guidelines. It’s recommended to
use them as they have the right look and feel for users on Android, and includes
other options to simplify their customization without having to write a lot of
code.
Samples
Recommended for you
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-03-25 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-03-25 UTC."],[],[],null,["# Text in Compose\n\nText is a central piece of any UI, and Jetpack Compose makes it easier to\ndisplay or write text. Compose leverages composition of its building blocks,\nmeaning you don't need to overwrite properties and methods or extend big classes\nto have a specific composable design and logic working the way you want.\n\nAs its base, Compose provides a [`BasicText`](/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicText(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.text.TextStyle,kotlin.Function1,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,androidx.compose.ui.graphics.ColorProducer))\nand [`BasicTextField`](/reference/kotlin/androidx/compose/foundation/text/package-summary#BasicTextField(androidx.compose.ui.text.input.TextFieldValue,kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Boolean,kotlin.Boolean,androidx.compose.ui.text.TextStyle,androidx.compose.foundation.text.KeyboardOptions,androidx.compose.foundation.text.KeyboardActions,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.ui.text.input.VisualTransformation,kotlin.Function1,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.graphics.Brush,kotlin.Function1)),\nwhich are the barebones to display text and handle user input. At a higher\nlevel, Compose provides [`Text`](/reference/kotlin/androidx/compose/material/package-summary#Text(androidx.compose.ui.text.AnnotatedString,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.font.FontStyle,androidx.compose.ui.text.font.FontWeight,androidx.compose.ui.text.font.FontFamily,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextDecoration,androidx.compose.ui.text.style.TextAlign,androidx.compose.ui.unit.TextUnit,androidx.compose.ui.text.style.TextOverflow,kotlin.Boolean,kotlin.Int,kotlin.Int,kotlin.collections.Map,kotlin.Function1,androidx.compose.ui.text.TextStyle))\nand [`TextField`](/reference/kotlin/androidx/compose/material/package-summary#TextField(androidx.compose.ui.text.input.TextFieldValue,kotlin.Function1,androidx.compose.ui.Modifier,kotlin.Boolean,kotlin.Boolean,androidx.compose.ui.text.TextStyle,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Function0,kotlin.Boolean,androidx.compose.ui.text.input.VisualTransformation,androidx.compose.foundation.text.KeyboardOptions,androidx.compose.foundation.text.KeyboardActions,kotlin.Boolean,kotlin.Int,kotlin.Int,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.ui.graphics.Shape,androidx.compose.material.TextFieldColors)),\nwhich are composables following Material Design guidelines. It's recommended to\nuse them as they have the right look and feel for users on Android, and includes\nother options to simplify their customization without having to write a lot of\ncode.\n\nSamples\n-------\n\nRecommended for you\n-------------------\n\n- Note: link text is displayed when JavaScript is off\n- [Display emoji](/develop/ui/compose/text/emoji)\n- [Custom design systems in Compose](/develop/ui/compose/designsystems/custom)\n- [Material Design 2 in Compose](/develop/ui/compose/designsystems/material)"]]