Class: ListItemComponent
- Defined in:
- app/components/list_item_component.rb
Overview
ListItem — individual item within a List.
Usage:
List {
ListItem { text "Apples" }
ListItem(icon: "users") { ListContent { text "Fomantic UI" } }
ListItem(href: "#") { text "Link item" }
}
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
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/components/list_item_component.rb', line 19 def to_s classes = class_names( { "active" => active, "disabled" => disabled }, "item" ) icon_el = icon ? tag.i(class: "#{icon} icon") : nil opts = { class: classes } opts[:"data-value"] = value if value inner = safe_join([ icon_el, @content ]) if href tag.a(inner, **(**opts, href: href)) else tag.div(inner, **(**opts)) end end |