Class: Spark::Nav::Sidebar

Inherits:
Component::Base show all
Defined in:
app/components/spark/nav/sidebar.rb

Constant Summary collapse

THEME =
%i[default primary]

Instance Method Summary collapse

Methods inherited from Component::Base

#selector, #to_s, #unique_id

Constructor Details

#initializeSidebar

Returns a new instance of Sidebar.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/components/spark/nav/sidebar.rb', line 28

def initialize(*)
  super

  classname.base = "spark-nav-sidebar"
  classname.add("theme-#{@theme}")
  data.add(nav_id: unique_id)

  if root_sidebar?
    data.add(scroll: true) 
    @toggle = false
  end

  aria.add(label: @label)
end