Class: Ariadne::Forms::Dsl::ButtonInput
- Defined in:
- lib/ariadne/forms/dsl/button_input.rb
Overview
:nodoc:
Constant Summary
Constants inherited from Input
Input::DEFAULT_SIZE, Input::SIZE_MAPPINGS, Input::SIZE_OPTIONS, Input::SPACE_DELIMITED_ARIA_ATTRIBUTES
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Input
#base_id, #builder, #caption, #form, #form_control, #ids, #input_attributes, #label_attributes, #validation_message
Instance Method Summary collapse
-
#initialize(name:, label:, **options, &block) ⇒ ButtonInput
constructor
A new instance of ButtonInput.
- #supports_validation? ⇒ Boolean
- #to_component ⇒ Object
-
#type ⇒ Object
:nocov:.
Methods inherited from Input
#add_input_aria, #add_input_classes, #add_input_data, #autofocus!, #caption?, #caption_id, #caption_template?, #disabled?, #focusable?, #hidden?, #id, #input?, #invalid?, #merge_input_attributes!, #remove_input_data, #render_caption_template, #required?, #size, #valid?, #validation_arguments, #validation_error_icon_target, #validation_id, #validation_message_arguments, #validation_messages, #validation_success_icon_target
Methods included from ClassNameHelper
Constructor Details
#initialize(name:, label:, **options, &block) ⇒ ButtonInput
Returns a new instance of ButtonInput.
10 11 12 13 14 15 16 17 |
# File 'lib/ariadne/forms/dsl/button_input.rb', line 10 def initialize(name:, label:, **, &block) @name = name @label = label @caption = .delete(:caption) @block = block super(**) end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
8 9 10 |
# File 'lib/ariadne/forms/dsl/button_input.rb', line 8 def block @block end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
8 9 10 |
# File 'lib/ariadne/forms/dsl/button_input.rb', line 8 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/ariadne/forms/dsl/button_input.rb', line 8 def name @name end |
Instance Method Details
#supports_validation? ⇒ Boolean
29 30 31 |
# File 'lib/ariadne/forms/dsl/button_input.rb', line 29 def supports_validation? false end |
#to_component ⇒ Object
19 20 21 22 |
# File 'lib/ariadne/forms/dsl/button_input.rb', line 19 def to_component html_attrs = @input_attributes || {} Ariadne::UI::Button::Component.new(**@options, html_attrs: html_attrs).with_content(@label) end |
#type ⇒ Object
:nocov:
25 26 27 |
# File 'lib/ariadne/forms/dsl/button_input.rb', line 25 def type :button end |