class SimpleForm::FormBuilder

def label(attribute_name, *args)

Experimental RBS support (using type sampling data from the type_fusion project).

def label: (Symbol attribute_name, *Array[ActiveSupport::SafeBuffer] args) -> untyped

This signature was generated using 1 sample from 1 application.


f.label :name, id: "cool_label"
f.label :name, required: false

f.label :name, label: "Name" # Same as above, but adds required tag
f.label :name, "Name" # Same behavior as Rails, do not add required tag
f.label :name # Do I18n lookup

== Examples

as :label_html.
through the :label option or using i18n. All the given options are sent
Creates a default label tag for the given attribute. You can give a label
def label(attribute_name, *args)
  return super if args.first.is_a?(String) || block_given?
  options = args.extract_options!.dup
  options[:label_html] = options.except(:label, :label_text, :required, :as)
  column      = find_attribute_column(attribute_name)
  input_type  = default_input_type(attribute_name, column, options)
  SimpleForm::Inputs::Base.new(self, attribute_name, column, input_type, options).label
end