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: state.Interaction,
    layout: Layout,
    link: option.Option(link.Link),
    orientation: layout.Orientation,
    variant: Variant,
  )
}

Constructors

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

Variant is the appearance variant of the card

pub type Variant {
  Elevated
  Filled
  Outlined
}

Constructors

  • Elevated
  • Filled
  • Outlined

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 const default_variant: Variant

Default variant

pub fn disabled(c: Card, i: state.Interaction) -> Card

disabled sets the interaction field of a Card

pub fn from_config(c: Config) -> Card

from_config creates a Card from a Config record

pub fn inline(c: Card, l: Layout) -> Card

inline sets the layout 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 new() -> Card

new creates a Card with default values

pub fn orientation(c: Card, o: layout.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

pub fn variant(c: Card, v: Variant) -> Card

variant sets the variant field of a Card

Search Document