m3e/badge

badge provides Lustre support for the M3E Badge component

Types

Badge is a compact visual indicator for counts, presence, or emphasis that can be attached to icons, buttons, or other components

Fields:

  • for: the identifier of the interactive control to which this element is attached
  • label: the text content of the badge
  • size: the size of the badge
  • badge_position: the position of the badge, when attached to another element
pub opaque type Badge

BadgePosition is the position of the badge, when attached to another element

pub type BadgePosition {
  Above
  AboveAfter
  AboveBefore
  After
  Before
  Below
  BelowAfter
  BelowBefore
}

Constructors

  • Above
  • AboveAfter
  • AboveBefore
  • After
  • Before
  • Below
  • BelowAfter
  • BelowBefore

Config holds the configuration for a Badge

pub type Config {
  Config(
    for: option.Option(String),
    label: String,
    size: config.Size,
    badge_position: BadgePosition,
  )
}

Constructors

Values

pub fn badge_position(
  b: Badge,
  badge_position: BadgePosition,
) -> Badge

badge_position sets the badge_position field

pub const default_badge_position: BadgePosition
pub fn default_config() -> Config

default_config creates a new Config with default values

pub const default_size: config.Size

Default size

pub fn for(b: Badge, for: option.Option(String)) -> Badge

for sets the for field

pub fn from_config(c: Config) -> Badge

from_config creates a Badge from a Config record

pub fn label(b: Badge, label: String) -> Badge

label sets the label field

pub fn new(label: String) -> Badge

new creates a new Badge

pub fn render(b: Badge) -> element.Element(msg)

render creates a Lustre Element from a Badge

pub fn render_config(config: Config) -> element.Element(msg)

render_config creates a Lustre Element directly from a Config

pub fn size(b: Badge, size: config.Size) -> Badge

size sets the size field

Search Document