Class: ElementComponent::Components::ListGroup

Inherits:
Element
  • Object
show all
Defined in:
lib/element_component/components/list_group.rb

Instance Attribute Summary

Attributes inherited from Element

#attributes, #contents, #element, #html

Instance Method Summary collapse

Methods inherited from Element

#add_attribute, #add_attribute!, #add_content, #add_content!, #new_element, #remove_attribute, #remove_attribute_value, #render, #reset_attributes!, #reset_contents!

Constructor Details

#initialize(flush: false, numbered: false, **attributes, &block) ⇒ ListGroup

Returns a new instance of ListGroup.



8
9
10
11
12
13
14
15
# File 'lib/element_component/components/list_group.rb', line 8

def initialize(flush: false, numbered: false, **attributes, &block)
  super("ul", &block)

  add_attribute(class: "list-group")
  add_attribute(class: "list-group-flush") if flush
  add_attribute(class: "list-group-numbered") if numbered
  add_attribute(attributes) unless attributes.empty?
end