Class: LabelComponent
- Includes:
- Attachable
- Defined in:
- app/components/label_component.rb
Overview
Label — labels and tags.
Usage:
Label(color: :blue) { text "New" }
Label(tag_style: true, color: :teal) { text "Featured" }
Label(ribbon: true, color: :red) { text "Sale" }
Label(icon: "mail", detail: "23") { text "Mail" }
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
Methods inherited from Component
default, #initialize, #render_in, slot
Constructor Details
This class inherits a constructor from Component
Instance Method Details
#to_s ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/components/label_component.rb', line 28 def to_s classes = class_names( "ui", color, size, pointing && "#{pointing} pointing", corner && "#{corner} corner", { "attached" => attached, "ribbon" => ribbon, "circular" => circular, "floating" => floating, "tag" => tag_style, "image" => image, "basic" => basic, "horizontal" => horizontal }, "label" ) icon_el = icon ? tag.i(class: "#{icon} icon") : nil detail_el = detail ? tag.div(class: "detail") { detail } : nil tag.div(class: classes) { safe_join([ icon_el, @content, detail_el ]) } end |