m3e/fab
/ fab provides Lustre support for the M3E FAB component
Types
Config holds the configuration for a FAB
pub type Config {
Config(
interaction: Interaction,
extension: Extension,
extended_label: option.Option(String),
form_submission: option.Option(form_submission.FormSubmission),
link: option.Option(link.Link),
elevation: Elevation,
size: size_few.Size,
variant: Variant,
)
}
Constructors
-
Config( interaction: Interaction, extension: Extension, extended_label: option.Option(String), form_submission: option.Option(form_submission.FormSubmission), link: option.Option(link.Link), elevation: Elevation, size: size_few.Size, variant: Variant, )
Elevation specifies the elevation of the element
pub type Elevation {
Raised
Lowered
}
Constructors
-
Raised -
Lowered
Extension specifies if the element is extended
pub type Extension {
Extended
NotExtended
}
Constructors
-
Extended -
NotExtended
FAB is a floating action button (FAB) used to present important actions
Fields:
- interaction: Whether the element is enabled or disabled
- extension: Whether the element is extended
- extended_label: Renders the label of an extended button
- form_submission: handles this element’s role in form submission
- link: Whether the element is a link
- elevation: Whether to present a lowered elevation
- size: The size of the button
- variant: The appearance variant of the button
pub opaque type FAB
Interaction specifies if the element is enabled or disabled
pub type Interaction {
Enabled
Disabled
DisabledInteractive
}
Constructors
-
Enabled -
Disabled -
DisabledInteractive
Slot gives type-safe names to each of the defined HTML named slots
pub type Slot {
CloseIcon
Label
MenuItemIcon
}
Constructors
-
CloseIcon -
Label -
MenuItemIcon
Values
pub fn default_config() -> Config
default_config creates a new Config with default values
pub const default_elevation: Elevation
pub const default_extension: Extension
pub const default_interaction: Interaction
pub const default_variant: Variant
pub fn disabled(f: FAB, interaction: Interaction) -> FAB
disabled sets the interaction field
pub fn extended_label(
f: FAB,
extended_label: option.Option(String),
) -> FAB
extended_label sets the extended_label field
pub fn form(
f: FAB,
form_submission: option.Option(form_submission.FormSubmission),
) -> FAB
form sets the form_submission field
pub fn render(
f: FAB,
attributes: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
render creates a Lustre Element from a FAB
Parameters:
- f: a FAB
- attributes: a list of additional Attributes
- children: a list of child Elements
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 slot(s: Slot) -> attribute.Attribute(msg)
slot creates a Lustre ‘slot’ Attribute(msg) for a Slot