Sitemap
MobileByteSensei

Deep-dives on Compose, Kotlin Multiplatform, and the agents now writing alongside us — from shipped work, not from the docs.

AnnotatedString is why you don’t need three Text composables in a Row

6 min readSep 29, 2026

--

Halfway through the series, and the component you’ve used most has a second API almost nobody reaches for.

Press enter or click to view image in full size
Day 50 — AnnotatedString instead of three Text composables

Day 50 of 100 — the halfway mark, and the start of the text pillar. Text is the composable you've written most, and it has a second parameter overload that solves a problem people usually solve with layout.

The case this post is about

One sentence, assembled from three composables because the middle word is bold:

Row {
Text("Signed in as ")
Text(userName, fontWeight = FontWeight.Bold)
Text(". Not you?")
}


It renders correctly on a phone in English. It does not wrap — the three pieces are laid out horizontally, so a long username pushes ". Not you?" off the edge rather than onto a second line. A screen reader announces three separate texts. A translator receives three fragments and no sentence.
One string with a styled range does all three correctly. This post follows that sentence, because the API that fixes it is the second one on the component everybody has used most, and almost nobody reaches for it.

The symptom

A sentence assembled out of three composables:

Row {
Text("Signed in as ")
Text(userName, fontWeight =…

--

--

Senior Software Engineer at OpenLane Inc, Open source contributor at Mifos Initiative and mentoring GSoC Students. https://github.com/therajanmaurya

MobileByteSensei
MobileByteSensei

Published in MobileByteSensei

Deep-dives on Compose, Kotlin Multiplatform, and the agents now writing alongside us — from shipped work, not from the docs.