class NfgUi::Bootstrap::Components::NavLink

Bootstrap Nav Component getbootstrap.com/docs/4.1/components/navs/

Public Instance Methods

component_family() click to toggle source
# File lib/nfg_ui/bootstrap/components/nav_link.rb, line 13
def component_family
  :nav
end
data() click to toggle source
# File lib/nfg_ui/bootstrap/components/nav_link.rb, line 25
def data
  tab ? super.merge!(toggle: 'tab') : super
end
dropdown() click to toggle source
render() { |: body), as: :a, **html_options, theme: nil, nav_link: true| ... } click to toggle source
# File lib/nfg_ui/bootstrap/components/nav_link.rb, line 29
def render
  if dropdown
    NfgUi::Bootstrap::Components::DropdownToggle.new({ body: (block_given? ? yield : body), as: :a, **html_options, theme: nil, nav_link: true }, view_context).render
  else
    super
  end
end
tab() click to toggle source
# File lib/nfg_ui/bootstrap/components/nav_link.rb, line 21
def tab
  options.fetch(:tab, nil)
end

Private Instance Methods

assistive_html_attributes() click to toggle source
# File lib/nfg_ui/bootstrap/components/nav_link.rb, line 51
def assistive_html_attributes
  return super unless tab
  { role: 'tab', aria: { controls: tab.tr('#', ''), selected: active } }
end
base_element() click to toggle source
# File lib/nfg_ui/bootstrap/components/nav_link.rb, line 39
def base_element
  :a
end
component_css_class() click to toggle source
# File lib/nfg_ui/bootstrap/components/nav_link.rb, line 43
def component_css_class
  'nav-link'
end
non_html_attribute_options() click to toggle source
# File lib/nfg_ui/bootstrap/components/nav_link.rb, line 47
def non_html_attribute_options
  super.push(:tab, :dropdown)
end