Class: Yattho::Alpha::TabNav
- Includes:
- TabNavHelper, TabbedComponentHelper
- Defined in:
- app/components/yattho/alpha/tab_nav.rb
Overview
Use ‘TabNav` to style navigation with a tab-based selected state, typically used for navigation placed at the top of the page. For panel navigation, use <%= link_to_component(Yattho::Alpha::TabPanels) %> instead.
Constant Summary collapse
- BODY_TAG_DEFAULT =
:ul
- TAG_DEFAULT =
:nav
- TAG_OPTIONS =
[TAG_DEFAULT, :div].freeze
Constants included from TabNavHelper
TabNavHelper::EXTRA_ALIGN_DEFAULT, TabNavHelper::EXTRA_ALIGN_OPTIONS
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
-
#initialize(label:, tag: TAG_DEFAULT, body_arguments: {}, **system_arguments) ⇒ TabNav
constructor
A new instance of TabNav.
Methods included from TabNavHelper
#tab_nav_body_classes, #tab_nav_classes, #tab_nav_tab_classes
Methods included from TabbedComponentHelper
Methods inherited from Component
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Constructor Details
#initialize(label:, tag: TAG_DEFAULT, body_arguments: {}, **system_arguments) ⇒ TabNav
Returns a new instance of TabNav.
114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'app/components/yattho/alpha/tab_nav.rb', line 114 def initialize(label:, tag: TAG_DEFAULT, body_arguments: {}, **system_arguments) @align = EXTRA_ALIGN_DEFAULT @system_arguments = system_arguments @body_arguments = body_arguments @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, TAG_DEFAULT) @system_arguments[:classes] = tab_nav_classes(system_arguments[:classes]) @body_arguments[:tag] = BODY_TAG_DEFAULT @body_arguments[:classes] = tab_nav_body_classes(body_arguments[:classes]) aria_label_for_page_nav(label) end |