Class: Primer::Alpha::UnderlineNav
- Includes:
- TabbedComponentHelper, UnderlineNavHelper
- Defined in:
- app/components/primer/alpha/underline_nav.rb
Overview
Use ‘UnderlineNav` to style navigation links with a minimal underlined selected state, typically placed at the top of the page.
For panel navigation, use <%= link_to_component(Primer::Alpha::UnderlinePanels) %> instead.
Constant Summary collapse
- BODY_TAG_DEFAULT =
:ul
- TAG_DEFAULT =
:nav
- TAG_OPTIONS =
[TAG_DEFAULT, :div].freeze
Constants included from UnderlineNavHelper
UnderlineNavHelper::ACTIONS_TAG_DEFAULT, UnderlineNavHelper::ACTIONS_TAG_OPTIONS, UnderlineNavHelper::ALIGN_DEFAULT, UnderlineNavHelper::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
Constants included from Primer::AttributesHelper
Primer::AttributesHelper::PLURAL_ARIA_ATTRIBUTES, Primer::AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
-
#initialize(label:, tag: TAG_DEFAULT, align: ALIGN_DEFAULT, body_arguments: {}, **system_arguments) ⇒ UnderlineNav
constructor
A new instance of UnderlineNav.
Methods included from UnderlineNavHelper
#underline_nav_action_classes, #underline_nav_body_classes, #underline_nav_classes, #underline_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
Methods included from Primer::AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(label:, tag: TAG_DEFAULT, align: ALIGN_DEFAULT, body_arguments: {}, **system_arguments) ⇒ UnderlineNav
Returns a new instance of UnderlineNav.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/components/primer/alpha/underline_nav.rb', line 56 def initialize(label:, tag: TAG_DEFAULT, align: ALIGN_DEFAULT, body_arguments: {}, **system_arguments) @align = fetch_or_fallback(ALIGN_OPTIONS, align, ALIGN_DEFAULT) @system_arguments = system_arguments @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, TAG_DEFAULT) @system_arguments[:classes] = underline_nav_classes(@system_arguments[:classes], @align) @body_arguments = body_arguments @body_arguments[:tag] = :ul @body_arguments[:classes] = underline_nav_body_classes(@body_arguments[:classes]) aria_label_for_page_nav(label) end |