Class: Primer::TabNavComponent
- Includes:
- ViewComponent::SlotableV2
- Defined in:
- app/components/primer/tab_nav_component.rb
Overview
Use TabNav to style navigation with a tab-based selected state, typically used for navigation placed at the top of the page.
Defined Under Namespace
Classes: MultipleSelectedTabsError, NoSelectedTabsError, TabComponent
Constant Summary
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
- #before_render ⇒ Object
-
#initialize(aria_label: nil, with_panel: false, **system_arguments) ⇒ TabNavComponent
constructor
A new instance of TabNavComponent.
Methods included from JoinStyleArgumentsHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Constructor Details
#initialize(aria_label: nil, with_panel: false, **system_arguments) ⇒ TabNavComponent
Returns a new instance of TabNavComponent.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/components/primer/tab_nav_component.rb', line 39 def initialize(aria_label: nil, with_panel: false, **system_arguments) @aria_label = aria_label @with_panel = with_panel @system_arguments = system_arguments @system_arguments[:tag] ||= :div @system_arguments[:classes] = class_names( "tabnav", system_arguments[:classes] ) end |
Instance Method Details
#before_render ⇒ Object
51 52 53 |
# File 'app/components/primer/tab_nav_component.rb', line 51 def before_render validate_single_selected_tab end |