Radio Component
This class combines the configuration and the core styling of a radio button.
This class offers the following configuration features:
the label(mapping) static or dynamic via a Flow or customized content see the examples below
some predefined styling variants (size)
the style of the selected state
the style of the radio
the style of the label
the groupname
link an external boolean flow to set the selected state of the box
link an external boolean flow to set the disabled state of the box
link events of the switch like
`changes`with external handlers
This can be done within a functional expression that is the last parameter of the factory function, called build. It offers an initialized instance of this RadioComponent class as receiver, so every mutating method can be called for configuring the desired state for rendering the radio.
Example usage
// simple use case
val cheeseStore = storeOf(false)
radio(value = cheeseStore) {
label("with extra cheese") // set the label
}
// manual event handling and styling options
radio {
label("with extra cheese") // set the label
size { normal } // choose a predefined size
selected(cheeseStore.data) // link a [Flow<Boolean>] in order to visualize the checked state
events { // open inner context with all DOM-element events
changes.states() handledBy cheeseStore.update // connect the changes event with the state store
}
element {
// exposes the underlying HTML input element for direct access. Use with caution!
}
}Constructors
Functions
Property to manage the severity value of the component.
This function manages the task to map a value of the Severity enumeration to a corresponding style defined within the SeverityStyles interface. The severity itself is taken from the severity property, so only the styling interface's implementation has to be injected: