Skip to content

Instantly share code, notes, and snippets.

@ChristianKienle
Created February 26, 2019 15:43
Show Gist options
  • Save ChristianKienle/619782c76b0f3165da770aa93018c79b to your computer and use it in GitHub Desktop.
Save ChristianKienle/619782c76b0f3165da770aa93018c79b to your computer and use it in GitHub Desktop.

Form items require special class depending on the type of input elements

If you have a form item with a text input element the HTML looks like this:

<div class="fd-form__item">
    <label class="fd-form__label" for="OatmD552">
        Normal Input:
    </label>
    <input type="text" class="fd-form__control" id="OatmD552" placeholder="Field placeholder text">
    <span class="fd-form__message">
        Pellentesque metus lacus commodo eget justo ut rutrum varius nunc
    </span>
</div>

If you instead have a form item with a checkbox, the HTML looks like this:

<div class="fd-form__item fd-form__item--check">
  <label class="fd-form__label" for="Ai4ez611">
    <input type="checkbox" class="fd-form__control" id="Ai4ez611">Text Option
  </label>
</div>

Notice the additional class fd-form__item--check. Is there no other way to do that? Implementing this in Vue is of course possible but we have to do some "dirty" things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment