Reputation: 4698
Simple Form includes a Foundation 5 template.
However, I cannot find any template files modified for Foundation 6 on the web.
How well does the generated forms work with Foundation 6? Moreover, any generous share of Foundation 6 template or tips on modifying the existing template?
Upvotes: 8
Views: 1154
Reputation: 815
To get hints (aka help text) working correctly, edit config/simple_form_foundation.rb and add:
b.use :hint, wrap_with: { tag: :p, class: 'help-text' }
Upvotes: 0
Reputation: 11
Just a little progress, you can set in config file simple_form.rb
this:
config.wrappers .... do |c|
...
c.use :error, wrap_with: { tag: :small, class: 'form-error is-visible'
..
end
and error messages will be formatted .. However, I did not find solution for labels and inputs, so the @Chris's solution for labels and inputs is still needed. However, if you don't need red labels and inputs, this is sufficient
Upvotes: 1
Reputation: 18090
I am not sure if simple_form can be configured to provide what Foundation 6 requires for fields with errors.
Until I can figure that out (if, if, if), I have this hack in place using Sass @extend
:
// TODO: This is a hack to get Foundation 6 styles on simple_form
// elements with errors.
.input.error {
label {
@extend .is-invalid-label;
}
input,
textarea,
select {
@extend .is-invalid-input;
}
small.error {
@extend .form-error;
@extend .is-visible;
}
}
Are you dissatisfied with this answer? I am too. I hope that someone can "show me up" on this with a better answer.
Upvotes: 8