Class: UI::TabsTriggerComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::TabsTriggerComponent
- Includes:
- TabsTriggerBehavior
- Defined in:
- app/view_components/ui/tabs_trigger_component.rb
Overview
TabsTrigger component (ViewComponent) Button that activates associated content panel
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(value: "", default_value: "", orientation: "horizontal", disabled: false, classes: "", attributes: {}) ⇒ TabsTriggerComponent
constructor
A new instance of TabsTriggerComponent.
Methods included from TabsTriggerBehavior
#trigger_html_attributes, #trigger_state
Constructor Details
#initialize(value: "", default_value: "", orientation: "horizontal", disabled: false, classes: "", attributes: {}) ⇒ TabsTriggerComponent
Returns a new instance of TabsTriggerComponent.
20 21 22 23 24 25 26 27 |
# File 'app/view_components/ui/tabs_trigger_component.rb', line 20 def initialize(value: "", default_value: "", orientation: "horizontal", disabled: false, classes: "", attributes: {}) @value = value @default_value = default_value @orientation = orientation @disabled = disabled @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/view_components/ui/tabs_trigger_component.rb', line 29 def call attrs = trigger_html_attributes attrs[:data] = attrs[:data].merge(@attributes.fetch(:data, {})) content_tag :button, **attrs.merge(@attributes.except(:data)) do content end end |