module Playbook::PbForm::FormBuilder::CheckboxField

def check_box(name, data: {}, props: {})

def check_box(name, data: {}, props: {})
  value = props[:value] ||= 1
  input = super(name, { required: props[:required], data: data }, value)
  label_text = name.to_s.gsub("_", " ")
  props[:margin_bottom] = "sm"
  props[:form_spacing] = true
  # Refactor and dry up, solve adding nil error
  if props[:label]
    @template.pb_rails("caption", props: { text: label_text, margin_bottom: "xs" }) +
      @template.pb_rails("checkbox", props: props) do
        input
      end
  else
    @template.pb_rails("checkbox", props: props) do
      input
    end
  end
end