Christiano
10/23/2025, 6:49 PM<br/> in texts in kobweb?
I noticed you can use the innerHtml of an Element to inject text which has some <br/>. But doing something like SpanText(text = "Hello, this is a longer text with a line break.\nHere is the new line.") does not work out of the box...
Otherwise, adding markdown support also works, but makes it more bloated when it's only for 1 part of the content... 🤔 😅David Herman
10/23/2025, 6:53 PMBr(), is that not available for your case?David Herman
10/23/2025, 6:53 PMDavid Herman
10/23/2025, 6:54 PMText and Br calls, let me search ...S.
10/23/2025, 6:56 PMColumn around multiple SpanTextChristiano
10/23/2025, 6:56 PMDavid Herman
10/23/2025, 6:57 PMDavid Herman
10/23/2025, 6:57 PMstr.split("\n").forEach { line -> if (line.isNotEmpty()) SpanText(line) else Br()
Something like that should workDavid Herman
10/23/2025, 6:59 PMColumn in my code, you'll have to treat it a bit differently if your text just lives in a normal Div )S.
10/23/2025, 6:59 PMDavid Herman
10/23/2025, 7:00 PM"Hello\nWorld" to Text("Hello"); Br(); Text("World")S.
10/23/2025, 7:01 PM<string name="why_classrooms_headline">More Time Teaching,\nLess Time Managing</string>
H1(Modifier.whiteSpace(WhiteSpace.PreWrap).textAlign(TextAlign.Center).toAttrs()) {
Text(Res.strings.why_classrooms_headline)
}David Herman
10/23/2025, 7:01 PMDavid Herman
10/23/2025, 7:01 PMText callS.
10/23/2025, 7:01 PMChristiano
10/23/2025, 7:02 PMpreWrap indeed works as well... wow... 😅Christiano
10/23/2025, 7:03 PM.split like that!!David Herman
10/23/2025, 7:04 PMRes.strings.why_classrooms_headline.addTextElements()
where
@Composable
fun String.addTextElements() {
val lines = this.split("\n")
lines.forEachIndexed { i, line ->
Text(line)
if (i < lines.lastIndex) Br()
}
}David Herman
10/23/2025, 7:04 PM