m3e/split_button

split_button provides Lustre support for the M3E Split Button component

Types

Config holds the configuration for a Split Button

pub type Config(msg) {
  Config(
    leading: element.Element(msg),
    size: config.Size,
    trailing: element.Element(msg),
    variant: Variant,
  )
}

Constructors

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

pub type Slot {
  LeadingButton
  TrailingButton
}

Constructors

  • LeadingButton
  • TrailingButton

SplitButton provides a primary action alongside a menu of related actions, uniting two buttons in a single expressive surface

Fields:

  • leading: the leading part of the split button
  • size: the size of the split button
  • trailing: the trailing part of the split button
  • variant: the appearance variant of the split button
pub opaque type SplitButton(msg)

Variant is the appearance variant of the Split Button

pub type Variant {
  Elevated
  Filled
  Outlined
  Tonal
}

Constructors

  • Elevated
  • Filled
  • Outlined
  • Tonal

Values

pub fn default_config(
  leading: element.Element(msg),
  trailing: element.Element(msg),
) -> Config(msg)

default_config creates a new Config with default values

pub const default_variant: Variant
pub fn from_config(c: Config(msg)) -> SplitButton(msg)

from_config creates a SplitButton from a Config record

pub fn leading(
  s: SplitButton(msg),
  leading: element.Element(msg),
) -> SplitButton(msg)

leading sets the leading field

pub fn new(
  leading: element.Element(msg),
  trailing: element.Element(msg),
) -> SplitButton(msg)

new creates a new SplitButton

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

render creates a Lustre Element(msg) from a Split Button

Parameters:

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

render_config creates a Lustre Element directly from a Config

pub fn size(
  s: SplitButton(msg),
  size: config.Size,
) -> SplitButton(msg)

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 trailing(
  s: SplitButton(msg),
  trailing: element.Element(msg),
) -> SplitButton(msg)

trailing sets the trailing field

pub fn variant(
  s: SplitButton(msg),
  variant: Variant,
) -> SplitButton(msg)

variant sets the variant field

Search Document