Class: Spark::Nav::Toggle
- Inherits:
-
Component::Base
- Object
- ActionView::Component::Base
- Component::Base
- Spark::Nav::Toggle
- Defined in:
- app/components/spark/nav/toggle.rb
Instance Method Summary collapse
-
#initialize ⇒ Toggle
constructor
A new instance of Toggle.
Methods inherited from Component::Base
Constructor Details
#initialize ⇒ Toggle
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 |