Sha256: 4fed04466732be6466f60bd147d87ed68c2673d442d92833447ad9fc4086ca65

Contents?: true

Size: 655 Bytes

Versions: 2

Compression:

Stored size: 655 Bytes

Contents

# frozen_string_literal: true

module Ariadne
  module Forms
    module Dsl
      # :nodoc:
      class ButtonInput < Input
        attr_reader :name, :label, :block

        def initialize(name:, label:, **options, &block)
          @name = name
          @label = label
          @caption = options.delete(:caption)
          @block = block

          super(**options)
        end

        def to_component
          Ariadne::UI::Button::Component.new(**@options).with_content(@label)
        end

        # :nocov:
        def type
          :button
        end

        def supports_validation?
          false
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.81 lib/ariadne/forms/dsl/button_input.rb
ariadne_view_components-0.0.80.3 lib/ariadne/forms/dsl/button_input.rb