Class: Nav::TabPanels::TabComponent

Inherits:
ItemComponent
  • Object
show all
Defined in:
app/components/spark/nav/tab_panels/tab_component.rb

Instance Method Summary collapse

Instance Method Details

#before_renderObject



4
5
6
7
8
# File 'app/components/spark/nav/tab_panels/tab_component.rb', line 4

def before_render
  aria_attr controls: parent.tag_attrs[:id], selected: !!active
  data_attr anchor: href, add_class: "active"
  add_class "active" if active
end

#renderObject



10
11
12
# File 'app/components/spark/nav/tab_panels/tab_component.rb', line 10

def render
  (:li, id: parent.tab_wrapper_id, class: "nav-tab-wrapper #{active ? "active" : nil}") { super }
end