m3e/switch
switch provides Lustre support for the M3E Switch component
Types
Config holds the configuration for a Switch
pub type Config {
Config(
label: option.Option(String),
icons: Icons,
checked: state.CheckedState,
disabled: state.Interaction,
form_submission: option.Option(form_submission.FormSubmission),
)
}
Constructors
-
Config( label: option.Option(String), icons: Icons, checked: state.CheckedState, disabled: state.Interaction, form_submission: option.Option(form_submission.FormSubmission), )
Switch is a configuration type representing an M3E Switch
Fields:
- id: id of the switch,
- label: label on the switch
- icons: The icons to present
- checked: Whether the element is checked
- disabled: Whether the element is disabled
- form_submission: handles this element’s role in form submission
pub opaque type Switch
Values
pub fn checked(s: Switch, checked: state.CheckedState) -> Switch
checked sets the checked field
pub fn default_config() -> Config
default_config creates a new Config with default values
pub const default_icons: Icons
pub fn disabled(s: Switch, disabled: state.Interaction) -> Switch
disabled sets the disabled field
pub fn form(
s: Switch,
form_submission: option.Option(form_submission.FormSubmission),
) -> Switch
form sets theform_submission field when the switch is used in a form
Pass None to name & value to clear the form controls
pub fn label(s: Switch, label: option.Option(String)) -> Switch
label sets the label field
pub fn render(
s: Switch,
attributes: List(attribute.Attribute(msg)),
) -> List(element.Element(msg))
render creates a list of Lustre Elements from a Switch
pub fn render_config(
config: Config,
attributes: List(attribute.Attribute(msg)),
) -> List(element.Element(msg))
render_config creates a Lustre Element directly from a Config