Skip to content

Instantly share code, notes, and snippets.

@minimul
Last active March 11, 2020 11:53
Show Gist options
  • Save minimul/b232f460b920215e055ebae5aef6af66 to your computer and use it in GitHub Desktop.
Save minimul/b232f460b920215e055ebae5aef6af66 to your computer and use it in GitHub Desktop.
# Use this setup block to configure all options available in SimpleForm.
require_relative '../../app/helpers/tailwind_helper'
SimpleForm.setup do |config|
config.error_notification_class = 'alert alert-danger'
config.button_class = 'btn btn-default'
config.boolean_label_class = nil
include TailwindHelper
config.wrappers :vertical_form, tag: 'div', class: "mt-6", error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :label, class: tw_label
b.wrapper tag: 'div', class: "mt-1 rounded-md shadow-sm" do |ba|
ba.use :input, class: tw_field
ba.use :error, wrap_with: { tag: 'span', class: 'help-block' }
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment