https://kotlinlang.org logo
#compose
Title
# compose
j

jean

03/04/2024, 3:09 PM
Hi! I’m creating custom composables with the runtime library. Something like this :
Copy code
@Composable
fun Text(
    text: String,
    alignment: TextAlignment = TextAlignment.Left,
    style: TextStyle = DefaultTextStyle,
) {
    ComposeNode<TextNode, ComposePrintApplier>(
        factory = ::TextNode,
    ) {
        set(text) { this.text = it }
        set(alignment) { this.alignment = it }
        set(style) { this.style = it }
    }
}
It’s defined in a module where I only have a dependency on the runtime library and it looks like
@Preview
isn’t a part of it. I guess one can get out-of-the-box previews only with composable elements from the compose-ui library?