Method: Primer::Alpha::TabNav#initialize

Defined in:
app/components/primer/alpha/tab_nav.rb

#initialize(label:, tag: TAG_DEFAULT, body_arguments: {}, **system_arguments) ⇒ TabNav

Returns a new instance of TabNav.

Parameters:

  • tag (Symbol) (defaults to: TAG_DEFAULT)

    <%= one_of(Primer::Alpha::TabNav::TAG_OPTIONS) %>

  • label (String)

    Sets an ‘aria-label` that helps assistive technology users understand the purpose of the links, and distinguish it from similar elements.

  • body_arguments (Hash) (defaults to: {})

    <%= link_to_system_arguments_docs %> for the body wrapper.

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'app/components/primer/alpha/tab_nav.rb', line 51

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