# <label class="custom-control custom-checkbox">
#   <input type="checkbox" class="custom-control-input">
#   <span class="custom-control-label">Remember me</span>
# </label>
class CheckboxTablerInput < SimpleForm::Inputs::Base
  def input(_wrapper_options)
    template.tag.label(class: 'custom-control custom-checkbox') do
      template.concat @builder.check_box(attribute_name, class: 'custom-control-input')
      template.concat span_tag
    end
  end

  def span_tag
    field_name = options[:field_name] ||= object.class.human_attribute_name(attribute_name)

    template.tag.span(class: 'custom-control-label') do
      field_name
    end
  end

  def label(_wrapper_options)
    ''
  end
end
