m3e/nav_menu_item
nav_menu_item provides Lustre support for the M3E Nav Menu Item component
Types
Config holds the configuration for a NavMenuItem
pub type Config {
Config(
badge: option.Option(String),
interaction: state.Interaction,
leading_icon_name: option.Option(String),
label: String,
expansion: Expansion,
selection: state.SelectionState,
selected_icon_name: option.Option(String),
toggle_icon_name: option.Option(String),
)
}
Constructors
-
Config( badge: option.Option(String), interaction: state.Interaction, leading_icon_name: option.Option(String), label: String, expansion: Expansion, selection: state.SelectionState, selected_icon_name: option.Option(String), toggle_icon_name: option.Option(String), )
Expansion specifies if an item is open or closed
pub type Expansion {
Open
Closed
}
Constructors
-
Open -
Closed
NavMenuItem represents a navigation menu item
Fields:
- badge: Renders the badge of the item
- interaction: Whether the element is enabled or disabled
- leading_icon_name: Renders the icon of the item
- label: Renders the label of the item
- expansion: Whether the item is expanded
- selection: Whether the element is selected
- selected_icon_name: Renders the icon of the item when selected
- toggle_icon_name: Renders the toggle icon
pub opaque type NavMenuItem
Values
pub fn badge(
item: NavMenuItem,
badge: option.Option(String),
) -> NavMenuItem
badge sets the badge field
pub fn default_config(label: String) -> Config
default_config creates a new Config with default values
pub const default_expansion: Expansion
pub fn disabled(
item: NavMenuItem,
interaction: state.Interaction,
) -> NavMenuItem
disabled sets the interaction field
pub fn from_config(c: Config) -> NavMenuItem
from_config creates a NavMenuItem from a Config record
pub fn leading_icon_name(
item: NavMenuItem,
leading_icon_name: option.Option(String),
) -> NavMenuItem
leading_icon_name sets the leading_icon_name field
pub fn new(label: String) -> NavMenuItem
new creates a nav-menu-item with default values
Parameters:
- label: Renders the label of the item
pub fn open(
item: NavMenuItem,
expansion: Expansion,
) -> NavMenuItem
open sets the expansion field
pub fn render(
item: NavMenuItem,
attributes: List(attribute.Attribute(msg)),
) -> element.Element(msg)
render creates a Lustre Element(msg) from a NavMenuItem
Parameters:
- item: a NavMenuItem
- attributes: additional attributes
pub fn render_config(
config: Config,
attributes: List(attribute.Attribute(msg)),
) -> element.Element(msg)
render_config creates a Lustre Element directly from a Config
pub fn selected(
item: NavMenuItem,
selection: state.SelectionState,
) -> NavMenuItem
selected sets the selection field
pub fn selected_icon_name(
item: NavMenuItem,
selected_icon_name: option.Option(String),
) -> NavMenuItem
selected_icon_name sets the selected_icon_name field
pub fn slot(s: Slot) -> attribute.Attribute(msg)
slot creates a Lustre ‘slot’ Attribute(msg) for a Slot
pub fn toggle_icon_name(
item: NavMenuItem,
toggle_icon_name: option.Option(String),
) -> NavMenuItem
toggle_icon_name sets the toggle_icon_name field