Module: Klods::Components::Button
- Included in:
- Builders
- Defined in:
- lib/klods/components/button.rb
Instance Method Summary collapse
Instance Method Details
#button(a = nil, b = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/klods/components/button.rb', line 4 def (a = nil, b = nil) props, children = Core.normalize_args(a, b) merged = {"type" => "button"}.merge(props.transform_keys(&:to_s)) Core.build( tag: "button", base: "klods-button", modifiers: { variant: ->(v) { (v && v.to_s != "default") ? "klods-button--#{v}" : nil } }, props: merged, children: children ) end |
#button_group(a = nil, b = nil) ⇒ Object
16 17 18 19 |
# File 'lib/klods/components/button.rb', line 16 def (a = nil, b = nil) props, children = Core.normalize_args(a, b) Core.build(tag: "div", base: "klods-button-group", props: props, children: children) end |