Search code examples
ruby-on-railszurb-foundationsimple-formzurb-foundation-6

Foundation 6 with Rails Simple Form


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?


Solution

  • 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.