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: state.Interaction,
position_x: PositionX,
position_y: PositionY,
quick: AnimationState,
state: MenuState,
variant: Variant,
)
}
Constructors
-
Config( anchor: option.Option(String), interaction: state.Interaction, position_x: PositionX, position_y: PositionY, quick: AnimationState, state: MenuState, variant: Variant, )
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
Values
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: state.Interaction) -> Menu
disabled sets the interaction 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