Class: SdrViewComponents::Elements::ButtonComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- SdrViewComponents::Elements::ButtonComponent
- Defined in:
- app/components/sdr_view_components/elements/button_component.rb
Overview
Generic button component
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(label: nil, classes: [], variant: nil, size: nil, bordered: true, **options) ⇒ ButtonComponent
constructor
rubocop:disable Metrics/ParameterLists.
Methods inherited from BaseComponent
#args_for, #merge_actions, #merge_classes
Constructor Details
#initialize(label: nil, classes: [], variant: nil, size: nil, bordered: true, **options) ⇒ ButtonComponent
rubocop:disable Metrics/ParameterLists
7 8 9 10 11 12 13 14 15 |
# File 'app/components/sdr_view_components/elements/button_component.rb', line 7 def initialize(label: nil, classes: [], variant: nil, size: nil, bordered: true, **) # rubocop:disable Metrics/ParameterLists @label = label @classes = classes @variant = variant @size = size @options = @bordered = bordered super() end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
17 18 19 |
# File 'app/components/sdr_view_components/elements/button_component.rb', line 17 def label @label end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
17 18 19 |
# File 'app/components/sdr_view_components/elements/button_component.rb', line 17 def @options end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/components/sdr_view_components/elements/button_component.rb', line 19 def call tag.( class: ComponentSupport::ButtonSupport.classes(variant: @variant, size: @size, classes: @classes, bordered: @bordered), type: 'button', ** ) do label || content end end |