m3e/drawer_container

drawer_container provides Lustre support for the M3E DrawerContainer component

Types

Config is a transparent record used for bulk configuration

pub type Config(msg) {
  Config(
    end: State,
    end_divider: Divider,
    end_drawer: option.Option(element.Element(msg)),
    end_mode: Mode,
    main_content: element.Element(msg),
    start: State,
    start_divider: Divider,
    start_drawer: option.Option(element.Element(msg)),
    start_mode: Mode,
  )
}

Constructors

Divider determines if a divider is shown

pub type Divider {
  ShowDivider
  HideDivider
}

Constructors

  • ShowDivider
  • HideDivider

DrawerContainer is a responsive layout container that manages collapsible left and right drawers alongside main content

Fields:

  • end: The state of the end drawer (Open or Closed)
  • end_mode: The behavior mode of the end drawer
  • end_divider: Whether to show a divider between the end drawer and content
  • start: The state of the start drawer (Open or Closed)
  • start_mode: The behavior mode of the start drawer
  • start_divider: Whether to show a divider between the start drawer and content
pub opaque type DrawerContainer(msg)

Mode is the behaviour of a drawer

pub type Mode {
  Auto
  Over
  Push
  Side
}

Constructors

  • Auto
  • Over
  • Push
  • Side

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

pub type Slot {
  End
  Start
}

Constructors

  • End
  • Start

State determines if a drawer is open or closed

pub type State {
  Open
  Closed
}

Constructors

  • Open
  • Closed

Values

pub fn default_config() -> Config(msg)

default_config provides a starting point for configuration with sensible defaults.

pub const default_divider: Divider
pub const default_mode: Mode

Default Mode

pub const default_state: State
pub fn end(
  c: DrawerContainer(msg),
  end: State,
) -> DrawerContainer(msg)

end sets the end fieldq

pub fn end_divider(
  c: DrawerContainer(msg),
  end_divider: Divider,
) -> DrawerContainer(msg)

end_divider sets the end_divider field

pub fn end_drawer(
  c: DrawerContainer(msg),
  end_drawer: option.Option(element.Element(msg)),
) -> DrawerContainer(msg)

end_drawer sets the end_drawer field

pub fn end_mode(
  c: DrawerContainer(msg),
  end_mode: Mode,
) -> DrawerContainer(msg)

end_mode sets the end_mode field

pub fn from_config(config: Config(msg)) -> DrawerContainer(msg)

from_config bridges the transparent Config to the Opaque type

pub fn main_content(
  c: DrawerContainer(msg),
  main_content: element.Element(msg),
) -> DrawerContainer(msg)

main_content sets the main_content field

pub fn new() -> DrawerContainer(msg)

new creates a DrawerContainer with defaults

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

render creates a Lustre Element from a DrawerContainer

Parameters:

  • c: a DrawerContainer
  • attributes: a list of 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

Parameters:

  • config: a Config
  • attributes: a list of additional Attributes
pub fn slot(s: Slot) -> attribute.Attribute(msg)

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

pub fn start(
  c: DrawerContainer(msg),
  start: State,
) -> DrawerContainer(msg)

start sets the start field

pub fn start_divider(
  c: DrawerContainer(msg),
  start_divider: Divider,
) -> DrawerContainer(msg)

start_divider sets the start_divider field

pub fn start_drawer(
  c: DrawerContainer(msg),
  start_drawer: option.Option(element.Element(msg)),
) -> DrawerContainer(msg)

start_drawer sets the start_drawer field

pub fn start_mode(
  c: DrawerContainer(msg),
  start_mode: Mode,
) -> DrawerContainer(msg)

start_mode sets the start_mode field

Search Document