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: types.CheckedState,
    disabled: types.Interaction,
    form_submission: option.Option(form_submission.FormSubmission),
  )
}

Constructors

pub type Icons {
  Both
  Neither
  Selected
}

Constructors

  • Both
  • Neither
  • Selected

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: types.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: types.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 from_config(config: Config) -> Switch

from_config creates a Switch from a Config

pub fn icon(s: Switch, icons: Icons) -> Switch

icon sets the icons field

pub fn label(s: Switch, label: option.Option(String)) -> Switch

label sets the label field

pub fn new(id: String) -> Switch

new creates a Switch with default values

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

Search Document