m3e/fab

/ fab provides Lustre support for the M3E FAB component

Types

Config holds the configuration for a FAB

pub type Config {
  Config(
    interaction: Interaction,
    extension: Extension,
    extended_label: option.Option(String),
    form_submission: option.Option(form_submission.FormSubmission),
    link: option.Option(link.Link),
    elevation: Elevation,
    size: config.Size,
    variant: Variant,
  )
}

Constructors

Elevation specifies the elevation of the element

pub type Elevation {
  Raised
  Lowered
}

Constructors

  • Raised
  • Lowered

Extension specifies if the element is extended

pub type Extension {
  Extended
  NotExtended
}

Constructors

  • Extended
  • NotExtended

FAB is a floating action button (FAB) used to present important actions

Fields:

  • interaction: Whether the element is enabled or disabled
  • extension: Whether the element is extended
  • extended_label: Renders the label of an extended button
  • form_submission: handles this element’s role in form submission
  • link: Whether the element is a link
  • elevation: Whether to present a lowered elevation
  • size: The size of the button
  • variant: The appearance variant of the button
pub opaque type FAB

Interaction specifies if the element is enabled or disabled

pub type Interaction {
  Enabled
  Disabled
  DisabledInteractive
}

Constructors

  • Enabled
  • Disabled
  • DisabledInteractive

Slot gives type-safe names to each of the defined HTML named slots

pub type Slot {
  CloseIcon
  Label
  MenuItemIcon
}

Constructors

  • CloseIcon
  • Label
  • MenuItemIcon

Variant is the appearance variant of the button

pub type Variant {
  Primary
  PrimaryContainer
  Secondary
  SecondaryContainer
  Surface
  Tertiary
  TertiaryContainer
}

Constructors

  • Primary
  • PrimaryContainer
  • Secondary
  • SecondaryContainer
  • Surface
  • Tertiary
  • TertiaryContainer

Values

pub fn default_config() -> Config

default_config creates a new Config with default values

pub const default_elevation: Elevation
pub const default_extension: Extension
pub const default_interaction: Interaction
pub const default_size: config.Size

Default size

pub const default_variant: Variant
pub fn disabled(f: FAB, interaction: Interaction) -> FAB

disabled sets the interaction field

pub fn extended(f: FAB, extension: Extension) -> FAB

extended sets the extension field

pub fn extended_label(
  f: FAB,
  extended_label: option.Option(String),
) -> FAB

extended_label sets the extended_label field

pub fn form(
  f: FAB,
  form_submission: option.Option(form_submission.FormSubmission),
) -> FAB

form sets the form_submission field

pub fn from_config(c: Config) -> FAB

from_config creates a FAB from a Config record

pub fn link(f: FAB, link: option.Option(link.Link)) -> FAB

link sets the link field

pub fn lowered(f: FAB, elevation: Elevation) -> FAB

lowered sets the elevation field

pub fn new() -> FAB

new creates a new FAB with default values

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

render creates a Lustre Element from a FAB

Parameters:

  • f: a FAB
  • attributes: a list of additional Attributes
  • children: a list of child Elements
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

pub fn size(f: FAB, size: config.Size) -> FAB

size sets the size field

pub fn slot(s: Slot) -> attribute.Attribute(msg)

slot creates a Lustre ‘slot’ Attribute(msg) for a Slot

pub fn variant(f: FAB, variant: Variant) -> FAB

variant sets the variant field

Search Document