Class: Spark::Input::Switch

Inherits:
Checkbox show all
Defined in:
app/components/spark/input/switch.rb

Constant Summary collapse

SIZE =
%i[small medium].freeze
ALIGNMENT =
%i[left right].freeze

Instance Method Summary collapse

Methods inherited from Component::Base

#selector, #to_s, #unique_id

Constructor Details

#initializeSwitch

Returns a new instance of Switch.



12
13
14
15
16
17
# File 'app/components/spark/input/switch.rb', line 12

def initialize(*)
  super

  switch_class.add("size-#{@size}")
  switch_class.add("align-#{@align}") if @align
end

Instance Method Details

#switch_classObject



19
20
21
# File 'app/components/spark/input/switch.rb', line 19

def switch_class
  @switch_class ||= Classname.new(base: "spark-input-switch")
end