What are the plans for the final API for styling `...
# compose-web
s
What are the plans for the final API for styling
Text
component? Will it be consistent with https://developer.android.com/jetpack/compose/text or will it require wrapping it with
Span
as is at the moment?
o
There are two
Text
components: • one which is a part of HTML composables (has no style parameters, only text: String) • another one which is a part of widgets - https://github.com/JetBrains/compose-jb/blob/master/web/widgets/src/commonMain/kotlin/layouts/defaults/TextDefault.kt I guess you're asking about the first case? If so, then I think the idea behind HTML composables is to keep them as close as possible to HTML tags. That means there is no plan to add style to the @Composable fun Text(text: String) {}. (and I agree, there is no tag for text but we have it as a component) I agree that writing
Span(...) { Text("some text") }
is less convenient than having a ready to use styleable Text component. But that styleable Text probably won't be a part of HTML composables library.
Actually, we didn't really discuss it, so maybe @Akif Abasov [JB] what do you think about it?
s
Thanks, I didn't know about
TextDefault.kt
before. Sure, this makes sense to me to style with
Span
when working with DOM API.
a
@Oleksandr Karpovich [JB], i have same thoughts about it as before: at DOM layer API you need to use
Span
to style your text. Just to be sure which tag will be there if you have style or if you haven’t any style.
👍 2