m3e/segmented_button

segmented_button provides Lustre support for the M3E Segmented Button component

Types

Config holds the configuration for a SegmentedButton

pub type Config {
  Config(
    interaction: types.Interaction,
    indicator_visibility: IndicatorVisibility,
    selection_mode: types.SelectionMode,
    name: option.Option(String),
  )
}

Constructors

IndicatorVisibility specifies if the selection indicator is visible or hidden

pub type IndicatorVisibility {
  Visible
  Hidden
}

Constructors

  • Visible
  • Hidden

SegmentedButton provides Lustre support for the M3E Segmented Button component

Fields:

  • interaction: Whether the element is enabled or disabled
  • indicator_visibility: Whether to hide the selection indicator
  • selection_mode: Whether multiple options can be selected
  • name: The name that identifies the element when submitting the associated form
pub opaque type SegmentedButton

Values

pub fn default_config() -> Config

default_config creates a new Config with default values

pub const default_indicator_visibility: IndicatorVisibility
pub fn disabled(
  s: SegmentedButton,
  interaction: types.Interaction,
) -> SegmentedButton

disabled sets the interaction field

pub fn from_config(c: Config) -> SegmentedButton

from_config creates a SegmentedButton from a Config record

pub fn hide_selection_indicator(
  s: SegmentedButton,
  indicator_visibility: IndicatorVisibility,
) -> SegmentedButton

hide_selection_indicator sets the indicator_visibility field

pub fn multi(
  s: SegmentedButton,
  selection_mode: types.SelectionMode,
) -> SegmentedButton

multi sets the selection_mode field

pub fn name(
  s: SegmentedButton,
  name: option.Option(String),
) -> SegmentedButton

name sets the name field

pub fn new() -> SegmentedButton

new creates a new SegmentedButton with default values

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

render creates a Lustre Element(msg) from a SegmentedButton

Parameters:

  • s: a SegmentedButton
  • attributes: additional attributes
  • children: additional children
pub fn render_config(
  config: Config,
  attributes: List(attribute.Attribute(msg)),
  children: List(element.Element(msg)),
) -> element.Element(msg)

render_config creates a Lustre Element directly from a Config

Search Document