m3e/menu

menu provides Lustre support for the M3E Menu component

Types

AnimationState specifies if a menu uses animations or is instant

pub type AnimationState {
  Animated
  Instant
}

Constructors

  • Animated
  • Instant

Config holds the configuration for a Menu

pub type Config {
  Config(
    anchor: option.Option(String),
    interaction: types.Interaction,
    position_x: PositionX,
    position_y: PositionY,
    quick: AnimationState,
    state: MenuState,
    variant: Variant,
  )
}

Constructors

Menu presents a list of choices on a temporary surface

Fields:

  • anchor: The id of the element to which the menu is anchored
  • interaction: Whether the element is enabled or disabled
  • position_x: The position of the menu, on the x-axis
  • position_y: The position of the menu, on the y-axis
  • quick: Whether to skip opening and closing animations
  • state: Whether the menu is open or closed
  • variant: The appearance variant of the menu
pub opaque type Menu

MenuState specifies if a menu is open or closed

pub type MenuState {
  Open
  Closed
}

Constructors

  • Open
  • Closed

PositionX is the position of the menu, on the x-axis

pub type PositionX {
  After
  Before
}

Constructors

  • After
  • Before

PositionY is the position of the menu, on the y-axis

pub type PositionY {
  Above
  Below
}

Constructors

  • Above
  • Below

Variant is the appearance variant of the menu

pub type Variant {
  Standard
  Vibrant
}

Constructors

  • Standard
  • Vibrant

Values

pub fn anchor(m: Menu, id: String) -> Menu

anchor sets the anchor field

pub const default_animation_state: AnimationState
pub fn default_config() -> Config

default_config creates a new Config with default values

pub const default_menu_state: MenuState
pub const default_position_x: PositionX
pub const default_position_y: PositionY
pub const default_variant: Variant
pub fn disabled(m: Menu, i: types.Interaction) -> Menu

disabled sets the interaction field

pub fn from_config(c: Config) -> Menu

from_config creates a Menu from a Config record

pub fn new() -> Menu

new creates a new Menu

pub fn open(m: Menu, s: MenuState) -> Menu

open sets the state field

pub fn position_x(m: Menu, position_x: PositionX) -> Menu

position_x sets the position_x field

pub fn position_y(m: Menu, position_y: PositionY) -> Menu

position_y sets the position_y field

pub fn quick(m: Menu, s: AnimationState) -> Menu

quick sets the quick field

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

render creates a Lustre Element from a Menu

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 variant(m: Menu, variant: Variant) -> Menu

variant sets the variant field

Search Document