HtmlText
3.0.0-beta02indexedEnables rendering HTML text in a text composable, supporting tags for bold, italic, links, and colors. Allows integration of theme colors and string arguments for flexible text styling.
Enables rendering HTML text in a text composable, supporting tags for bold, italic, links, and colors. Allows integration of theme colors and string arguments for flexible text styling.
HtmlText is a Kotlin Multiplatform library that allows you to render HTML content as Compose AnnotatedStrings. It supports basic formatting, hyperlinks, and color styling in a multiplatform-friendly way. HtmlText has been made accessible for screen readers and keyboard operation.
[!WARNING]
Starting with version 3.0.0-beta02, the Maven GroupId has changed tode.charlex.composeand artifact names changed frommaterial-html-texttohtml-text-material.
[!NOTE]
🚀 HtmlText is now Compose Multiplatform
To use colors like MaterialTheme.colors.primary in HtmlText, map simple colors.
HtmlText(
stringId = R.string.hello_world_cdata,
colorMapping = mapOf(Color.Red to MaterialTheme.colors.primary)
)
<resources>
<string name="hello_world_escaped">Hello <span style="color: #FF0000">World</span></string>
<string name="hello_world_cdata"><![CDATA[Hello <span style="color: #FF0000">World</span>]]>

Add actual HtmlText library:
dependencies {
implementation 'de.charlex.compose:html-text-material:3.0.0-beta02'
}
or
dependencies {
implementation 'de.charlex.compose:html-text-material3:3.0.0-beta02'
}
Copyright 2025 Alexander Karkossa
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance the License.
You may obtain a copy of the License at
http:
Unless applicable law agreed to writing, software
distributed under the License distributed an BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied.
See the License the specific language governing permissions
limitations under the License.
| Tag | Description |
|---|
<b> | Bold text |
<i> | Italic text |
<strike> | Strikethrough text |
<u> | Underlined text |
<ul> | Unordered list |
<ol start="3" type="1"> | Ordered list (a., A., 1.) |
<li> | List item |
<a href="..."> | Clickable link |
<span style="color: #0000FF"> | Colored text |
<span style="color: rgb(r,g,b)"> | Colored text |
<font color="#FF0000"> | Colored text |
<font color="rgb(r,g,b)"> | Colored text |
Surfaced from shared tags and platforms — no rankings paid for.