Class: Spark::Nav::Toggle

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

Instance Method Summary collapse

Methods inherited from Component::Base

#selector, #to_s, #unique_id

Constructor Details

#initializeToggle

Returns a new instance of Toggle.



8
9
10
11
12
13
14
15
16
17
# File 'app/components/spark/nav/toggle.rb', line 8

def initialize(*)
  super

  tag_attrs.add id: (@id || unique_id)
  aria.add(hidden: true)
  # When toggled on, adds an active class to itself and `nav-active` to `target` selector.
  data.add(nav_toggle: @target)

  classname.base = "nav-toggle"
end