Before (attempting) to use BEM, I'd mark my forms up something like this:
<form>
<h3 class="title">Form Heading <small>(if small tag is added)</small></h3>
<p>Short paragraph of text...</p>
<div class="form-group">
<label class="label">Username <em>*</em></label>
<div class="form-controls">
<input type="text" />
</div>
</div>
<div class="form-group error">
<label class="label">Email address <em>*</em></label>
<div class="form-controls">
<input type="text" />
</div>
</div>
<div class="form-group">
<label class="label">Label</label>
<div class="form-controls">
<input type="text" placeholder="" />
</div>
</div>
<div class="form-group">
<label class="label">Label</label>
<div class="form-controls">
<label class="radio"><input type="radio" name="radio" checked="checked" /> Option One</label>
<label class="radio"><input type="radio" name="radio" /> Option Two</label>
</div>
</div>
</form>
It seems, obvious to use form__group
instead of form-group
and form__controls
instead of form-controls
. Using elements like this, the form would NEED a class of form
on it - otherwise it makes no sense? Seems a bit strange on a default element though, I've not used <ul class="list">
for example, just <ul class="list--bordered">
for example.
I've created some quick, updated mark-up below, would this be acceptable?
<form class="form">
<h3 class="form__title">Form Heading <small>(if small tag is added)</small></h3>
<p>Short paragraph of text...</p>
<div class="form__group">
<label class="form__group-title">Username <em>*</em></label>
<div class="form__controls">
<input type="text" />
</div>
</div>
<div class="form__group error">
<label class="form__group-title">Email address <em>*</em></label>
<div class="form__controls">
<input type="text" />
</div>
</div>
<div class="form__group">
<label class="form__group-title">Label</label>
<div class="form__controls">
<input type="text" placeholder="" />
</div>
</div>
<div class="form__group">
<label class="form__group-title">Label</label>
<div class="form__controls">
<label class="form__radio"><input type="radio" name="radio" checked="checked" /> Option One</label>
<label class="form__radio"><input type="radio" name="radio" /> Option Two</label>
</div>
</div>
</form>
Thanks again!