module SimpleForm

def self.additional_classes_for(component)

def self.additional_classes_for(component)
  generate_additional_classes_for.include?(component) ? yield : []
end

def self.build(options = {})

Builds a new wrapper using SimpleForm::Wrappers::Builder.
def self.build(options = {})
  options[:tag] = :div if options[:tag].nil?
  builder = SimpleForm::Wrappers::Builder.new(options)
  yield builder
  SimpleForm::Wrappers::Root.new(builder.to_a, options)
end

def self.configured? #:nodoc:

:nodoc:
def self.configured? #:nodoc:
  @@configured
end

def self.default_input_size=(*)

def self.default_input_size=(*)
  SimpleForm.deprecator.warn "[SIMPLE_FORM] SimpleForm.default_input_size= is deprecated and has no effect", caller
end

def self.deprecator

def self.deprecator
  @deprecator ||= ActiveSupport::Deprecation.new("5.3", "SimpleForm")
end

def self.eager_load!

def self.eager_load!
  super
  SimpleForm::Inputs.eager_load!
  SimpleForm::Components.eager_load!
end

def self.file_methods

def self.file_methods
  SimpleForm.deprecator.warn(FILE_METHODS_DEPRECATION_WARN, caller)
  @@file_methods
end

def self.file_methods=(file_methods)

def self.file_methods=(file_methods)
  SimpleForm.deprecator.warn(FILE_METHODS_DEPRECATION_WARN, caller)
  @@file_methods = file_methods
end

def self.form_class=(value)

def self.form_class=(value)
  SimpleForm.deprecator.warn "[SIMPLE_FORM] SimpleForm.form_class= is deprecated and will be removed in 4.x. Use SimpleForm.default_form_class= instead", caller
  @@form_class = value
end

def self.include_component(component)


<% end %>
<%= f.input :title, prepend: true %>
<%= simple_form_for @blog, wrapper: input_group do |f| %>
# Using the custom component in the form.

end
end
b.use :append
b.use :input
b.optional :prepend
b.use :label
config.wrappers :input_group, tag: :div, error_class: :error do |b|
# Create a wrapper using the custom component.
SimpleForm.setup do |config|

end
end
...
def append

end
...
def prepend
module InputGroupComponent
# lib/components/input_group_component.rb
# Create a custom component in the path specified above.

Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
# The application needs to tell where the components will be.

Examples

component will be exposed to be used in the wrapper as Simple::Components
Includes a component to be used by Simple Form. Methods defined in a
def self.include_component(component)
  if Module === component
    SimpleForm::Inputs::Base.include(component)
  else
    raise TypeError, "SimpleForm.include_component expects a module but got: #{component.class}"
  end
end

def self.setup

to create a fresh initializer with all configuration values.
Default way to setup Simple Form. Run rails generate simple_form:install
def self.setup
  @@configured = true
  yield self
end

def self.wrapper(name)

Retrieves a given wrapper
def self.wrapper(name)
  @@wrappers[name.to_s] or raise WrapperNotFound, "Couldn't find wrapper with name #{name}"
end

def self.wrappers(*args, &block)

and store it in the given name.
Define a new wrapper using SimpleForm::Wrappers::Builder
def self.wrappers(*args, &block)
  if block_given?
    options                 = args.extract_options!
    name                    = args.first || :default
    @@wrappers[name.to_s]   = build(options, &block)
  else
    @@wrappers
  end
end