Module: Klods::Components::Badge

Included in:
Builders
Defined in:
lib/klods/components/badge.rb

Instance Method Summary collapse

Instance Method Details

#badge(a = nil, b = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/klods/components/badge.rb', line 4

def badge(a = nil, b = nil)
  props, children = Core.normalize_args(a, b)
  Core.build(
    tag: "span", base: "klods-badge",
    modifiers: {
      variant: ->(v) { (v && v.to_s != "default") ? "klods-badge--#{v}" : nil }
    },
    props: props, children: children
  )
end