m3e/checkbox

checkbox provides Lustre support for the M3E Checkbox component

Types

Checkbox holds all the values necessary to construct am M3E Checkbox

  • checked: whether the checkbox is checked
  • interaction: whether the checkbox is enabled or disabled
  • form_submission: handles this element’s role in form submission
  • requirement: Whether a value is required for the element
pub opaque type Checkbox

Config holds the configuration for a Checkbox

pub type Config {
  Config(
    checked: types.CheckedState,
    interaction: types.Interaction,
    form_submission: option.Option(form_submission.FormSubmission),
    requirement: types.Requirement,
  )
}

Constructors

Values

pub fn checked(
  checkbox: Checkbox,
  state: types.CheckedState,
) -> Checkbox

checked sets the checked field

pub fn default_config() -> Config

default_config creates a new Config with default values

pub const default_value: String
pub fn disabled(
  checkbox: Checkbox,
  interaction: types.Interaction,
) -> Checkbox

disabled sets the interaction field

pub fn form(
  checkbox: Checkbox,
  form_submission: option.Option(form_submission.FormSubmission),
) -> Checkbox

form sets up a Checkbox to participate in an HTML form

Pass None to name & value to clear the form controls

Parameters:

  • checkbox: a Checkbox
  • form_submission: a FormSubmission
pub fn from_config(c: Config) -> Checkbox

from_config creates a Checkbox from a Config record

pub fn new() -> Checkbox

new creates a new Checkbox with default values

pub fn render(checkbox: Checkbox) -> element.Element(msg)

render creates an HTML m3e-checkbox component from a Checkbox

pub fn render_config(config: Config) -> element.Element(msg)

render_config creates a Lustre Element directly from a Config

pub fn required(
  checkbox: Checkbox,
  requirement: types.Requirement,
) -> Checkbox

requirement sets the requirement field

Search Document