To make text bold in Jetpack Compose, set fontWeight = FontWeight.Bold on Text; for italic, set fontStyle = FontStyle.Italic. To style only some words, use buildAnnotatedString with SpanStyle. Underline has its own guide: Underline text in Jetpack Compose.
Page Contents
1. Bold text
@Composable
fun BoldText() {
Text(text = "Bold text", fontWeight = FontWeight.Bold)
}FontWeight goes from Thin (100) to Black (900). Common choices are Medium (500), SemiBold (600) and Bold (700). You can also pass a number: FontWeight(650) – this needs a variable font to show every step.
2. Italic text
@Composable
fun ItalicText() {
Text(text = "Italic text", fontStyle = FontStyle.Italic)
}3. Bold and italic together
Text(
text = "Bold italic text",
fontWeight = FontWeight.Bold,
fontStyle = FontStyle.Italic
)4. Bold or italic only part of a sentence
@Composable
fun PartlyBoldText() {
Text(
buildAnnotatedString {
append("Your order ")
withStyle(SpanStyle(fontWeight = FontWeight.Bold)) {
append("#1042")
}
append(" has ")
withStyle(SpanStyle(fontStyle = FontStyle.Italic)) {
append("shipped")
}
append(".")
}
)
}5. Bold, italic and underline in one example
If you need all three, add textDecoration. The underline guide covers underline in more depth (strikethrough, combined decorations, underlined links).
@Composable
fun BoldItalicUnderline() {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text("Bold", fontWeight = FontWeight.Bold)
Text("Italic", fontStyle = FontStyle.Italic)
Text("Underline", textDecoration = TextDecoration.Underline)
Text(
"All three",
fontWeight = FontWeight.Bold,
fontStyle = FontStyle.Italic,
textDecoration = TextDecoration.Underline
)
}
}6. Use the theme instead of hard-coding
For headings, a theme style keeps weight consistent across the app, and you can still override one property:
Text(
"Settings",
style = MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.Bold)
)Imports used in these examples
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.text.withStyle import androidx.compose.ui.unit.dp
Common problems
My custom font doesn’t look bold
A custom FontFamily needs a bold file (or a variable font) registered, e.g. Font(R.font.inter_bold, FontWeight.Bold). Otherwise Android fakes the bold, which can look blurry.
Italic does nothing
Some fonts have no italic style. Add an italic file with Font(R.font.x_italic, style = FontStyle.Italic).
Video tutorial
FAQ
How do I make text bold in Jetpack Compose?
Use Text("…", fontWeight = FontWeight.Bold).
How do I make only one word bold?
Wrap that word in withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { append("word") } inside buildAnnotatedString.
More Jetpack Compose text guides
- Text in Jetpack Compose: complete guide
- Underline text in Jetpack Compose
- Clickable text and links in Jetpack Compose
- Text padding in Jetpack Compose
