Component

interface Component<T>

Marker interface that every component should implement, so that the central render method appears in a unified way throughout this framework.

The render method has to be implemented in order to do the actual rendering of one component. This reduces the boilerplate code within the corresponding factory function(s):

open class MyComponent: Component {
override fun render(...) {
// some content rendering
}
}

RenderContext.myComponent(
// most params omitted
build: MyComponent.() -> Unit = {}
) {
MyComponent().apply(build).render(this, /* params */)
// ^^^^^^
// just start the rendering by one additional call!
}

Often a component needs additional parameters that are passed into the factory functions (remember that those should be located starting after the `styling` parameter in first position and before the `baseClass` parameter) Typical use cases are Stores or list of items, as for RenderContext.checkboxGroup for example. Those additional parameters should be passed via contructor injection into the component class:

open class MyComponent(protected val items: List<String>, protected val store: Store<String>?): Component {
override fun render(...) {
// some content rendering with access to the ``items`` and the ``store``
}
}

RenderContext.myComponent(
styling: BasicParams.() -> Unit,
items: List<String>, // two additional parameters
store: Store<String>? = null, // after ``styling`` and before ``baseClass``!
baseClass: StyleClass,
id: String?,
prefix: String
build: MyComponent.() -> Unit = {}
) {
MyComponent(items, store) // inject additional parameters
.apply(build)
.render(this, styling, baseClass, id, prefix) // pass context + regular parameters
}

Functions

equals
Link copied to clipboard
js
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
js
open fun hashCode(): Int
render
Link copied to clipboard
js
abstract fun render(context: RenderContext, styling: BoxParams.() -> Unit, baseClass: StyleClass, id: String?, prefix: String): T
Central method that should do the actual rendering of a component.
toString
Link copied to clipboard
js
open fun toString(): String

Inheritors

AlertComponent
Link copied to clipboard
AppFrameComponent
Link copied to clipboard
PushButtonComponent
Link copied to clipboard
CheckboxComponent
Link copied to clipboard
CheckboxGroupComponent
Link copied to clipboard
SingleFileSelectionComponent
Link copied to clipboard
MultiFileSelectionComponent
Link copied to clipboard
FormControlComponent
Link copied to clipboard
IconComponent
Link copied to clipboard
InputFieldComponent
Link copied to clipboard
NavbarComponent
Link copied to clipboard
PopoverComponent
Link copied to clipboard
RadioComponent
Link copied to clipboard
RadioGroupComponent
Link copied to clipboard
SpinnerComponent
Link copied to clipboard
StackComponent
Link copied to clipboard
SwitchComponent
Link copied to clipboard
TextAreaComponent
Link copied to clipboard
NavLinkComponent
Link copied to clipboard
SelectFieldComponent
Link copied to clipboard