# m3e/switch

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

This file was generated: By: m3e/generator version 0.1.0 At: 2026-05-05T14:38:23+10:00

         DO NOT EDIT

# Types

## Checked

</>

Checked is whether the element is checked.

    pub type Checked {
      IsChecked
      IsNotChecked
    }

### Constructors

-     IsChecked

-     IsNotChecked

## Config

</>

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

-     Config(
        checked: Checked,
        disabled: Disabled,
        icons: switch_icons.SwitchIcons,
        name: String,
        value: String,
      )

## Disabled

</>

Disabled is whether the element is disabled.

    pub type Disabled {
      IsDisabled
      IsNotDisabled
    }

### Constructors

-     IsDisabled

-     IsNotDisabled

## Switch

opaque </>

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

## checked

</>

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

checked sets the value of checked for this Switch.

## default_checked

</>

    pub const default_checked: Checked

## default_config

</>

    pub fn default_config() -> Config

default_config is the default configuration for this component.

## default_disabled

</>

    pub const default_disabled: Disabled

## default_icons

</>

    pub const default_icons: switch_icons.SwitchIcons

## default_name

</>

    pub const default_name: String

## default_value

</>

    pub const default_value: String

## disabled

</>

    pub fn disabled(record: Switch, disabled: Disabled) -> Switch

disabled sets the value of disabled for this Switch.

## from_config

</>

    pub fn from_config(config: Config) -> Switch

from_config creates a new Switch from the given configuration.

## icons

</>

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

icons sets the value of icons for this Switch.

## name

</>

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

name sets the value of name for this Switch.

## new

</>

    pub fn new() -> Switch

new creates a new Switch with the default configuration.

## render

</>

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

render creates a Lustre Element for a Switch

## render_config

</>

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

render_config creates a Lustre Element from a Switch Config

## value

</>

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

value sets the value of value for this Switch.

✨