m3e/expansion_panel
expansion_panel provides Lustre support for the M3E Expansion Panel component
Types
Config holds the configuration for an ExpansionPanel
pub type Config(msg) {
Config(
interaction: state.Interaction,
toggle_visibility: ToggleVisibility,
state: PanelState,
toggle_direction: Direction,
toggle_position: Direction,
header: String,
toggle_icon_name: option.Option(String),
actions: option.Option(List(element.Element(msg))),
)
}
Constructors
-
Config( interaction: state.Interaction, toggle_visibility: ToggleVisibility, state: PanelState, toggle_direction: Direction, toggle_position: Direction, header: String, toggle_icon_name: option.Option(String), actions: option.Option(List(element.Element(msg))), )
Direction is the direction of the expansion toggle
pub type Direction {
End
Start
}
Constructors
-
End -
Start
ExpansionPanel(msg) is a component that provides an expandable details-summary view
Fields:
- interaction: Whether the panel is enabled or disabled
- toggle_visibility: Whether to hide the expansion toggle
- state: Whether the panel is expanded
- toggle_direction: The direction of the expansion toggle
- toggle_position: The position of the expansion toggle
- header: The text displayed in the header
- toggle_icon_name: The name of the icon to display
- actions: Renders the actions bar of the panel
pub opaque type ExpansionPanel(msg)
PanelState specifies if the panel is expanded or collapsed
pub type PanelState {
Open
Closed
}
Constructors
-
Open -
Closed
Position is the position of the expansion toggle It has the same values as Direction
pub type Position =
Direction
Slot gives type-safe names to each of the defined HTML named slots
pub type Slot {
Actions
Header
ToggleIcon
}
Constructors
-
Actions -
Header -
ToggleIcon
ToggleVisibility specifies if the expansion toggle is hidden or shown
pub type ToggleVisibility {
ShowToggle
HideToggle
}
Constructors
-
ShowToggle -
HideToggle
Values
pub fn actions(
p: ExpansionPanel(msg),
actions: option.Option(List(element.Element(msg))),
) -> ExpansionPanel(msg)
actions sets the actions field
pub fn default_config() -> Config(msg)
default_config creates a new Config with default values
pub const default_direction: Direction
pub const default_panel_state: PanelState
pub const default_position: Direction
pub const default_toggle_visibility: ToggleVisibility
pub fn disabled(
p: ExpansionPanel(msg),
interaction: state.Interaction,
) -> ExpansionPanel(msg)
disabled sets the interaction field
pub fn from_config(c: Config(msg)) -> ExpansionPanel(msg)
from_config creates an ExpansionPanel from a Config record
pub fn header(
p: ExpansionPanel(msg),
header: String,
) -> ExpansionPanel(msg)
header sets the header field
pub fn hide_toggle(
p: ExpansionPanel(msg),
visibility: ToggleVisibility,
) -> ExpansionPanel(msg)
hide_toggle sets the toggle_visibility field
pub fn new(header: String) -> ExpansionPanel(msg)
new creates a new ExpansionPanel
Parameters:
- header: The text displayed in the header
pub fn open(
p: ExpansionPanel(msg),
state: PanelState,
) -> ExpansionPanel(msg)
open sets the state field
pub fn render(
p: ExpansionPanel(msg),
attributes: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
render creates a Lustre Element from an ExpansionPanel
pub fn render_config(
config: Config(msg),
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 slot(s: Slot) -> attribute.Attribute(msg)
slot creates a Lustre ‘slot’ Attribute(msg) for a Slot
pub fn toggle_direction(
p: ExpansionPanel(msg),
toggle_direction: Direction,
) -> ExpansionPanel(msg)
toggle_direction sets the toggle_direction field
pub fn toggle_icon_name(
p: ExpansionPanel(msg),
toggle_icon_name: option.Option(String),
) -> ExpansionPanel(msg)
toggle_icon_name sets the toggle_icon_name field
pub fn toggle_position(
p: ExpansionPanel(msg),
toggle_position: Direction,
) -> ExpansionPanel(msg)
toggle_position sets the toggle_position field