Class: Primer::UnderlineNavComponent
- Includes:
- TabbedComponentHelper
- Defined in:
- app/components/primer/underline_nav_component.rb
Overview
Use the UnderlineNav component to style navigation with a minimal underlined selected state, typically used for navigation placed at the top of the page.
Constant Summary collapse
- ALIGN_DEFAULT =
:left- ALIGN_OPTIONS =
[ALIGN_DEFAULT, :right].freeze
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
-
#initialize(with_panel: false, align: ALIGN_DEFAULT, body_classes: "", **system_arguments) ⇒ UnderlineNavComponent
constructor
A new instance of UnderlineNavComponent.
Methods included from TabbedComponentHelper
Methods included from JoinStyleArgumentsHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Constructor Details
#initialize(with_panel: false, align: ALIGN_DEFAULT, body_classes: "", **system_arguments) ⇒ UnderlineNavComponent
Returns a new instance of UnderlineNavComponent.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'app/components/primer/underline_nav_component.rb', line 104 def initialize(with_panel: false, align: ALIGN_DEFAULT, body_classes: "", **system_arguments) @with_panel = with_panel @align = fetch_or_fallback(ALIGN_OPTIONS, align, ALIGN_DEFAULT) @system_arguments = system_arguments @system_arguments[:tag] = :nav @system_arguments[:role] = :tablist @system_arguments[:classes] = class_names( @system_arguments[:classes], "UnderlineNav", "UnderlineNav--right" => @align == :right ) @body_arguments = { tag: :div, classes: class_names( "UnderlineNav-body", body_classes ) } end |