module Primer::Forms::Dsl::InputMethods

def action_menu(**options, &block)

Parameters:
  • block (Proc) -- The block passed to `#render` when the <%= link_to_component(Primer::Alpha::ActionMenu) %> is rendered. This block is passed an instance of <%= link_to_component(Primer::Alpha::ActionMenu) %>, which can be used to add items, dividers, etc.
  • options (Hash) -- The options accepted by the <%= link_to_component(Primer::Alpha::ActionMenu) %> component.
def action_menu(**options, &block)
  options = decorate_options(**options)
  add_input ActionMenuInput.new(builder: builder, form: form, **options, &block)
end

def add_input(input)

Other tags:
    Private: -
def add_input(input)
  inputs << input
end

def auto_complete(**options, &block)

Parameters:
  • block (Proc) -- A block that will be yielded a reference to the input object so it can be customized.
  • options (Hash) -- The options accepted by the autocomplete input (see forms docs).
def auto_complete(**options, &block)
  options = decorate_options(**options)
  add_input AutoCompleteInput.new(builder: builder, form: form, **options, &block)
end

def button(**options, &block)

Parameters:
  • block (Proc) -- A block that will be yielded a reference to the input object so it can be customized.
  • options (Hash) -- The options accepted by the button input (see forms docs).
def button(**options, &block)
  options = decorate_options(**options)
  add_input ButtonInput.new(builder: builder, form: form, **options, &block)
end

def check_box(**options, &block)

Parameters:
  • block (Proc) -- A block that will be yielded a reference to the input object so it can be customized.
  • options (Hash) -- The options accepted by the check box input (see forms docs).
def check_box(**options, &block)
  add_input CheckBoxInput.new(builder: builder, form: form, **options, &block)
end

def check_box_group(**options, &block)

Parameters:
  • block (Proc) -- A block that will be yielded a reference to the input object so it can be customized.
  • options (Hash) -- The options accepted by the check box group input (see forms docs).
def check_box_group(**options, &block)
  add_input CheckBoxGroupInput.new(builder: builder, form: form, **options, &block)
end

def decorate_options(**options)

Other tags:
    Private: -
def decorate_options(**options)
  options
end

def fields_for(*args, **kwargs, &block)

Parameters:
  • kwargs (Hash) -- The options accepted by the form reference input (see forms docs). Includes keyword arguments passed to Rails' [`fields_for` helper](https://api.rubyonrails.org/v7.0.4/classes/ActionView/Helpers/FormHelper.html#method-i-fields_for).
  • args (Array) -- Positional arguments passed to Rails' [`fields_for` helper](https://api.rubyonrails.org/v7.0.4/classes/ActionView/Helpers/FormHelper.html#method-i-fields_for).
def fields_for(*args, **kwargs, &block)
  add_input FormReferenceInput.new(*args, builder: builder, form: form, **kwargs, &block)
end

def hidden(**options)

Parameters:
  • options (Hash) -- The options accepted by the hidden input (see forms docs).
def hidden(**options)
  add_input HiddenInput.new(builder: builder, form: form, **options)
end

def inputs

Other tags:
    Private: -
def inputs
  @inputs ||= []
end

def multi(**options, &block)

Parameters:
  • block (Proc) -- A block that will be yielded a reference to the input object so it can be customized.
  • options (Hash) -- The options accepted by the multi input (see forms docs).
def multi(**options, &block)
  add_input MultiInput.new(builder: builder, form: form, **options, &block)
end

def radio_button_group(**options, &block)

Parameters:
  • block (Proc) -- A block that will be yielded a reference to the input object so it can be customized.
  • options (Hash) -- The options accepted by the radio button group input (see forms docs).
def radio_button_group(**options, &block)
  add_input RadioButtonGroupInput.new(builder: builder, form: form, **options, &block)
end

def select_list(**options, &block)

Parameters:
  • block (Proc) -- A block that will be yielded a reference to the input object so it can be customized.
  • options (Hash) -- The options accepted by the select list input (see forms docs).
def select_list(**options, &block)
  options = decorate_options(**options)
  add_input SelectInput.new(builder: builder, form: form, **options, &block)
end

def separator

Adds a horizontal separator to the form.
def separator
  add_input Separator.new
end

def submit(**options, &block)

Parameters:
  • block (Proc) -- A block that will be yielded a reference to the input object so it can be customized.
  • options (Hash) -- The options accepted by the submit button input (see forms docs).
def submit(**options, &block)
  options = decorate_options(**options)
  add_input SubmitButtonInput.new(builder: builder, form: form, **options, &block)
end

def text_area(**options, &block)

Parameters:
  • block (Proc) -- A block that will be yielded a reference to the input object so it can be customized.
  • options (Hash) -- The options accepted by the text area input (see forms docs).
def text_area(**options, &block)
  options = decorate_options(**options)
  add_input TextAreaInput.new(builder: builder, form: form, **options, &block)
end

def text_field(**options, &block)

Parameters:
  • block (Proc) -- A block that will be yielded a reference to the input object so it can be customized.
  • options (Hash) -- The options accepted by the text field input (see forms docs).
def text_field(**options, &block)
  options = decorate_options(**options)
  add_input TextFieldInput.new(builder: builder, form: form, **options, &block)
end