severity Class Of
open fun severityClassOf(severityStyle: SeverityStyles): Flow<StyleClass>
Content copied to clipboard
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:
open class MyComponent {
override fun render(/*...*/, prefix: String) {
someElement {
// set fitting severity for example by using a store with validation
severity(/* get severity from somewhere */)
// apply the correct style based upon the severity
className(severityClassOf(Theme().myComponent.severity, prefix))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It's a good idea to offer a
specific property in the
component's theme section
based upon ``SeverityStyles``
}
}
}Content copied to clipboard
Return
a flow of the current mapped style class. Can be applied to the component via className extension method
Parameters
severity Style
definition for the different styling for each state