Sha256: e92fc3c43d18ace0e9b49da8de6a245eeed6d188a21676f2d228bf3d7d3b1172

Contents?: true

Size: 852 Bytes

Versions: 36

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true

module Primer
  module Forms
    module Dsl
      # :nodoc:
      class RadioButtonGroupInput < Input
        attr_reader :name, :label, :radio_buttons

        def initialize(name:, label: nil, **system_arguments)
          @name = name
          @label = label
          @radio_buttons = []

          super(**system_arguments)

          add_label_classes("FormControl-label", "mb-2")

          yield(self) if block_given?
        end

        def to_component
          RadioButtonGroup.new(input: self)
        end

        def type
          :radio_button_group
        end

        def radio_button(**system_arguments, &block)
          @radio_buttons << RadioButtonInput.new(
            builder: @builder, form: @form, name: @name, **system_arguments, &block
          )
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
primer_view_components-0.0.121 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.120 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.119 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.118 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.117 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.116 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.115 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.114 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.113 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.112 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.111 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.110 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.109 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.108 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.107 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.106 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.105 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.104 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.103 lib/primer/forms/dsl/radio_button_group_input.rb
primer_view_components-0.0.102 lib/primer/forms/dsl/radio_button_group_input.rb