Class: Primer::Navigation::TabComponent
- Defined in:
- app/components/primer/navigation/tab_component.rb
Overview
This component is part of navigation components such as ‘Primer::TabNavComponent` and `Primer::UnderlineNavComponent` and should not be used by itself.
Constant Summary
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Attribute Summary collapse
-
#selected ⇒ Object
readonly
Returns the value of attribute selected.
Instance Method Summary collapse
-
#initialize(selected: false, with_panel: false, icon_classes: "", **system_arguments) ⇒ TabComponent
constructor
A new instance of TabComponent.
Methods included from JoinStyleArgumentsHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Constructor Details
#initialize(selected: false, with_panel: false, icon_classes: "", **system_arguments) ⇒ TabComponent
Returns a new instance of TabComponent.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'app/components/primer/navigation/tab_component.rb', line 79 def initialize(selected: false, with_panel: false, icon_classes: "", **system_arguments) @selected = selected @icon_classes = icon_classes @system_arguments = system_arguments @system_arguments[:role] = :tab if with_panel @system_arguments[:tag] ||= :button @system_arguments[:type] = :button else @system_arguments[:tag] ||= :a end return unless @selected if @system_arguments[:tag] == :a @system_arguments[:"aria-current"] = :page else @system_arguments[:"aria-selected"] = true end end |
Instance Attribute Details
#selected ⇒ Object (readonly)
Returns the value of attribute selected.
43 44 45 |
# File 'app/components/primer/navigation/tab_component.rb', line 43 def selected @selected end |