Class: Primer::Forms::Button
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Primer::Forms::Button
- Defined in:
- app/lib/primer/forms/button.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ButtonAttributeGenerator
Instance Method Summary collapse
-
#initialize(input:, type: :button) ⇒ Button
constructor
A new instance of Button.
- #input_arguments ⇒ Object
Methods inherited from BaseComponent
compile!, #content, #input?, #perform_render, #render?, #to_component, #type
Methods included from ActsAsComponent
#compile!, extended, #renders_templates
Methods included from ClassNameHelper
Constructor Details
#initialize(input:, type: :button) ⇒ Button
Returns a new instance of Button.
33 34 35 36 37 38 39 40 41 42 |
# File 'app/lib/primer/forms/button.rb', line 33 def initialize(input:, type: :button) @input = input @type = type @input.add_input_classes("FormField-input flex-self-start") @input.merge_input_arguments!(tag_attributes.deep_symbolize_keys) # rails uses a string for this, but PVC wants a symbol @input.merge_input_arguments!(type: type.to_sym) end |
Instance Method Details
#input_arguments ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'app/lib/primer/forms/button.rb', line 44 def input_arguments @input_arguments ||= @input.input_arguments.deep_dup.tap do |args| # rails uses :class but PVC wants :classes args[:classes] = class_names( args[:classes], args.delete(:class) ) end end |