m3e/switch

Switch is an on/off control that can be toggled by clicking.

This file was generated by m3e/generator

     DO NOT EDIT

Types

Checked is whether the element is checked.

pub type Checked {
  IsChecked
  IsNotChecked
}

Constructors

  • IsChecked
  • IsNotChecked

Config is a public record for configuring this component.

pub type Config {
  Config(
    checked: Checked,
    disabled: Disabled,
    icons: switch_icons.SwitchIcons,
    name: String,
    value: String,
  )
}

Constructors

Disabled is whether the element is disabled.

pub type Disabled {
  IsDisabled
  IsNotDisabled
}

Constructors

  • IsDisabled
  • IsNotDisabled

Switch is a View Model for this component

Fields:

  • checked: Whether the element is checked.
  • disabled: Whether the element is disabled.
  • icons: The icons to present.
  • name: The name that identifies the element when submitting the associated form.
  • value: A string representing the value of the switch.
pub opaque type Switch

Values

pub fn checked(record: Switch, checked: Checked) -> Switch

checked sets the value of checked for this Switch.

pub const default_checked: Checked
pub fn default_config() -> Config

default_config is the default configuration for this component.

pub const default_disabled: Disabled
pub const default_name: String
pub const default_value: String
pub fn disabled(record: Switch, disabled: Disabled) -> Switch

disabled sets the value of disabled for this Switch.

pub fn from_config(config: Config) -> Switch

from_config creates a new Switch from the given configuration.

pub fn icons(
  record: Switch,
  icons: switch_icons.SwitchIcons,
) -> Switch

icons sets the value of icons for this Switch.

pub fn name(record: Switch, name: String) -> Switch

name sets the value of name for this Switch.

pub fn new() -> Switch

new creates a new Switch with the default configuration.

pub fn render(
  model: Switch,
  attributes: List(attribute.Attribute(msg)),
) -> element.Element(msg)

render creates a Lustre Element for a Switch

pub fn render_config(
  c: Config,
  attributes: List(attribute.Attribute(msg)),
) -> element.Element(msg)

render_config creates a Lustre Element from a Switch Config

pub fn value(record: Switch, value: String) -> Switch

value sets the value of value for this Switch.

Search Document