Component
This class defines a very simple UI component abstraction. Every Component is supposed to be rendered inside other Components forming a tree where the head is Component.Root.
Components are being rendered through render extension function.
Example usage:
object MessageComponent : Component<MessageComponent.MyComponentConfig>(::MyComponentConfig) {
override fun SimplePanel.render(): Effect {
h1(config.message)
return Effect.Success
}
class MyComponentConfig {
var message: String = "Hello, World!"
}
}
object RootComponent : Component.Root() {
override fun SimplePanel.render(): Effect {
render(MessageComponent) {
message = "Bye, World!"
}
return Effect.Success
}
}
class MyApplication : Application() {
override fun start() {
root("root") {
render(RootComponent)
}
}
}
Content copied to clipboard
Parameters
configCreator
creator of the provided TConfig.
See also
Inheritors
Types
Link copied to clipboard
Root component. Supposed to be rendered right in the Root panel. Note that Component.Root can not be configured.