Class: Trek::TabsComponent::ItemComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Trek::TabsComponent::ItemComponent
- Defined in:
- app/components/trek/tabs_component.rb
Instance Attribute Summary collapse
-
#first ⇒ Object
writeonly
Sets the attribute first.
Instance Method Summary collapse
Methods included from StimulusHelpers
#stimulus_action, #stimulus_class, #stimulus_class_hash, #stimulus_class_key, #stimulus_target, #stimulus_target_hash, #stimulus_target_key, #stimulus_value, #stimulus_value_hash, #stimulus_value_key
Methods included from CssClassesHelpers
#class_for, #class_names_for, #root_class
Methods included from IdentifierHelper
Instance Attribute Details
#first=(value) ⇒ Object (writeonly)
Sets the attribute first
15 16 17 |
# File 'app/components/trek/tabs_component.rb', line 15 def first=(value) @first = value end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/components/trek/tabs_component.rb', line 17 def call link_to( label, "##{id}", class: classes, id: "#{id}-tab", role: "tab", aria: { controls: id, selected: first_item? }, data: { action: "keydown->trek--tabs#onTabKeydown" } ) end |
#panel ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'app/components/trek/tabs_component.rb', line 31 def panel tag.div( content, class: class_for("panel"), id:, role: "tabpanel", aria: { labelledby: "#{id}-tab" }, hidden: !first_item? ) end |