Class: Bs5::ButtonGroupComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Bs5::ButtonGroupComponent
- Defined in:
- app/components/bs5/button_group_component.rb
Constant Summary collapse
- SIZES =
{ small: :sm, large: :lg }.with_indifferent_access.freeze
- CLASS_PREFIX =
'btn-group'
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#vertical ⇒ Object
readonly
Returns the value of attribute vertical.
Instance Method Summary collapse
- #component_attributes ⇒ Object
-
#initialize(options = {}) ⇒ ButtonGroupComponent
constructor
A new instance of ButtonGroupComponent.
- #render? ⇒ Boolean
Constructor Details
#initialize(options = {}) ⇒ ButtonGroupComponent
Returns a new instance of ButtonGroupComponent.
10 11 12 13 14 |
# File 'app/components/bs5/button_group_component.rb', line 10 def initialize( = {}) @options = .symbolize_keys @vertical = @options.delete(:vertical) @size = @options.delete(:size) end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
8 9 10 |
# File 'app/components/bs5/button_group_component.rb', line 8 def size @size end |
#vertical ⇒ Object (readonly)
Returns the value of attribute vertical.
8 9 10 |
# File 'app/components/bs5/button_group_component.rb', line 8 def vertical @vertical end |
Instance Method Details
#component_attributes ⇒ Object
20 21 22 23 24 |
# File 'app/components/bs5/button_group_component.rb', line 20 def component_attributes = { role: 'group' } @options[:class] = component_class @options.merge() end |
#render? ⇒ Boolean
16 17 18 |
# File 'app/components/bs5/button_group_component.rb', line 16 def render? content.present? end |