mendraw/widget
Resolves generated Mendix widget bindings and constructs their properties.
import gleam/result
import mendraw/widget
import mendraw/interop
use component <- result.try(widget.component("Switch"))
Ok(interop.component_el(component, [
widget.editable_prop("textAttr", value, display, set_value),
widget.action_prop("onClick", handler),
], []))
Types
Describes a generated widget-binding lookup failure.
pub type WidgetError {
ComponentWasNotFound(name: String, reason: String)
}
Constructors
-
ComponentWasNotFound(name: String, reason: String)The requested widget is not registered in the generated binding table.
Values
pub fn action_prop(
key key: String,
handler handler: fn() -> Nil,
) -> attribute.Attribute
Creates an action widget property.
pub fn component(
name name: String,
) -> Result(interop.JsComponent, WidgetError)
Resolves a Mendix widget component by name.
pub fn editable_prop(
key key: String,
value value: a,
display_value display_value: String,
set_value set_value: fn(a) -> Nil,
) -> attribute.Attribute
Creates an editable widget property.
pub fn prop(
key key: String,
value value: a,
) -> attribute.Attribute
Creates a dynamic widget property.