m3e/card
card provides Lustre support for the M3E Card component
Types
Actionability specifies if a card is interactive
pub type Actionability {
Actionable
Static
}
Constructors
-
Actionable -
Static
Card is a flexible, expressive container for presenting a unified subject
Fields:
- actionability: Whether the card is “actionable” and will respond to user interaction
- interaction: Whether the element is enabled or disabled
- layout: Whether to present the card inline with surrounding content
- link: Whether the card is a link
- orientation: The orientation of the card
- variant: The appearance variant of the card
pub opaque type Card
Config holds the configuration for a Card
pub type Config {
Config(
actionability: Actionability,
interaction: types.Interaction,
layout: Layout,
link: option.Option(link.Link),
orientation: types.Orientation,
variant: Variant,
)
}
Constructors
-
Config( actionability: Actionability, interaction: types.Interaction, layout: Layout, link: option.Option(link.Link), orientation: types.Orientation, variant: Variant, )
Layout specifies if a card is rendered inline or as a block
pub type Layout {
Inline
Block
}
Constructors
-
Inline -
Block
Slot gives type-safe names to each of the defined HTML named slots
pub type Slot {
Actions
Content
Footer
Header
}
Constructors
-
Actions -
Content -
Footer -
Header
Values
pub fn actionable(c: Card, a: Actionability) -> Card
actionable sets the actionability field of a Card
pub const default_actionability: Actionability
pub fn default_config() -> Config
default_config creates a new Config with default values
pub const default_layout: Layout
pub fn disabled(c: Card, i: types.Interaction) -> Card
disabled sets the interaction field of a Card
pub fn link(c: Card, link: option.Option(link.Link)) -> Card
link sets the link field of a Card
pub fn orientation(c: Card, o: types.Orientation) -> Card
orientation sets the orientation field of a Card
pub fn render(
c: Card,
attributes: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
render creates a Lustre Element from a Card
Parameters:
- c: a Card
- 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