m3e/nav_item

nav_item provides Lustre support for the M3E Nav Item component

Types

Config holds the configuration for a NavItem

pub type Config {
  Config(
    focusability: Focusability,
    interaction: types.Interaction,
    link: option.Option(link.Link),
    orientation: types.Orientation,
    selection: types.SelectionState,
  )
}

Constructors

Focusability specifies if a disabled item is interactive (focusable)

pub type Focusability {
  Interactive
  Static
}

Constructors

  • Interactive
  • Static

NavItem provides Lustre support for the M3E Nav Item component

Fields:

  • interaction: Whether the element is enabled or disabled.
  • focusability: Whether the element is disabled and interactive.
  • link: all the attributes of an HTML link
  • orientation: The layout orientation of the item.
  • selection: Whether the element is selected.
pub opaque type NavItem

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

pub type Slot {
  Icon
  SelectedIcon
}

Constructors

  • Icon
  • SelectedIcon

Values

pub fn default_config() -> Config

default_config creates a new Config with default values

pub const default_focusability: Focusability
pub const default_orientation: types.Orientation
pub fn disabled(
  item: NavItem,
  interaction: types.Interaction,
) -> NavItem

disabled sets the interaction field

pub fn disabled_interactive(
  item: NavItem,
  focusability: Focusability,
) -> NavItem

disabled_interactive sets the focusability field

pub fn from_config(c: Config) -> NavItem

from_config creates a NavItem from a Config record

pub fn link(
  item: NavItem,
  link: option.Option(link.Link),
) -> NavItem

link sets the link field

pub fn new() -> NavItem

new creates a new NavItem

pub fn orientation(
  item: NavItem,
  orientation: types.Orientation,
) -> NavItem

orientation sets the orientation field

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

render creates a Lustre Element(msg) from a NavItem

Parameters:

  • item: a NavItem
  • attributes: additional attributes
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 selected(
  item: NavItem,
  selection: types.SelectionState,
) -> NavItem

selected sets the selection field

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

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

Search Document