3.1 #forms.base Form defaults

These are the default base styles applied to HTML form elements.

Component classes can override these styles, but if no class applies a style to an HTML form element, these styles will be the ones displayed.

3.1.1 #forms.base.button Buttons

Buttons built with the <button> element are the most flexible for styling purposes. But <input> elements with type set to submit, image, reset, or button are also supported.

Below is the default button styling. To see variations on the button styling see the button component.

Examples
Default styling

:hover
Hover styling.

:active:hover
Depressed button styling.

<p>
  <button type="button" class="[modifier class]">Standard button</button>
  <button type="button" class="[modifier class]" disabled>disabled button</button>
</p>
<p>
  <button type="submit" class="[modifier class]">Submit button</button>
  <button type="submit" class="[modifier class]" disabled>Disabled submit button</button>
</p>
<p>
  <button type="reset" class="[modifier class]">Reset button</button>
  <button type="reset" class="[modifier class]" disabled>Disabled reset button</button>
</p>
<p>
  <input type="button" class="[modifier class]" value="Input button">
  <input type="button" class="[modifier class]" value="Disabled input button" disabled>
</p>
<p>
  <input type="submit" class="[modifier class]" value="Input submit button">
  <input type="submit" class="[modifier class]" value="Disabled input submit button" disabled>
</p>
<p>
  <input type="reset" class="[modifier class]" value="Input reset button">
  <input type="reset" class="[modifier class]" value="Disabled input reset button" disabled>
</p>

3.1.2 #forms.base.fieldset Fieldsets

The <fieldset> element groups a set of form fields, optionally under a common name given by the <legend> element.

Example
A fieldset
A disabled fieldset
<fieldset class="">
  <legend>A fieldset</legend>
  <label for="fieldsetText">Text input</label>
  <input type="text" id="fieldsetText" placeholder="Text input">
</fieldset>

<fieldset class="" disabled>
  <legend>A disabled fieldset</legend>
  <div>
    <label for="fieldsetText2">Disabled text input</label>
    <input type="text" id="fieldsetText2" placeholder="Disabled input">
  </div>
  <div>
    <label for="fieldsetSelect">Disabled select menu</label>
    <select id="fieldsetSelect">
      <option>Disabled select</option>
    </select>
  </div>
  <div>
    <label><input type="checkbox"> Can't check this</label>
  </div>
</fieldset>

3.1.3 #forms.base.input Inputs

The <input> element is mostly used for text-based inputs that include the HTML5 types: text, search, tel, url, email, password, date, time, number, range, color, and file.

Example
<div>
  <label for="inputText">Text</label>
  <input type="text" class="" id="inputText" placeholder="Enter some text">
</div>
<div>
  <label for="inputSearch">Search</label>
  <input type="search" class="" id="inputSearch" placeholder="Search">
</div>
<div>
  <label for="inputTel">Telephone</label>
  <input type="text" class="" id="inputTel" placeholder="Enter some text">
</div>
<div>
  <label for="inputURL">URL</label>
  <input type="url" class="" id="inputURL" placeholder="Enter a URL">
</div>
<div>
  <label for="inputEmail">Email address</label>
  <input type="email" class="" id="inputEmail" placeholder="Enter email">
</div>
<div>
  <label for="inputPassword">Password</label>
  <input type="password" class="" id="inputPassword" placeholder="Password">
</div>
<div>
  <label for="inputDate">Date</label>
  <input type="date" class="" id="inputDate" placeholder="Enter a date">
</div>
<div>
  <label for="inputTime">Time</label>
  <input type="time" class="" id="inputTime" placeholder="Enter a time">
</div>
<div>
  <label for="inputNumber">Number</label>
  <input type="number" class="" id="inputNumber" placeholder="Enter a number">
</div>
<div>
  <label for="inputRange">Range</label>
  <input type="range" class="" id="inputRange" placeholder="Enter a range">
</div>
<div>
  <label for="inputColor">Color</label>
  <input type="color" class="" id="inputColor" placeholder="Enter a color">
</div>
<div>
  <label for="inputFile">File input</label>
  <input type="file" class="" id="inputFile">
</div>

<div>
  <label for="inputText">Disabled text</label>
  <input type="text" class="" disabled id="inputText" placeholder="Disabled text">
</div>
<div>
  <label for="inputSearch">Disabled search</label>
  <input type="search" class="" disabled id="inputSearch" placeholder="Disabled search">
</div>
<div>
  <label for="inputTel">Disabled telephone</label>
  <input type="text" class="" disabled id="inputTel" placeholder="Disabled telephone">
</div>
<div>
  <label for="inputURL">Disabled URL</label>
  <input type="url" class="" disabled id="inputURL" placeholder="Disabled URL">
</div>
<div>
  <label for="inputEmail">Disabled email address</label>
  <input type="email" class="" disabled id="inputEmail" placeholder="Disabled email">
</div>
<div>
  <label for="inputPassword">Disabled password</label>
  <input type="password" class="" disabled id="inputPassword" placeholder="Disabled password">
</div>
<div>
  <label for="inputDate">Disabled date</label>
  <input type="date" class="" disabled id="inputDate" placeholder="Disabled date">
</div>
<div>
  <label for="inputTime">Disabled time</label>
  <input type="time" class="" disabled id="inputTime" placeholder="Disabled time">
</div>
<div>
  <label for="inputNumber">Disabled number</label>
  <input type="number" class="" disabled id="inputNumber" placeholder="Disabled number">
</div>
<div>
  <label for="inputRange">Disabled range</label>
  <input type="range" class="" disabled id="inputRange" placeholder="Disabled range">
</div>
<div>
  <label for="inputColor">Disabled color</label>
  <input type="color" class="" disabled id="inputColor" placeholder="Disabled color">
</div>
<div>
  <label for="inputFile">Disabled file input</label>
  <input type="file" class="" disabled id="inputFile">
</div>

3.1.4 #forms.base.input-checkbox Checkboxes

If an <input> element has the type="checkbox" attribute set, the form field is displayed as a checkbox.

It's recommended that you don't attempt to style these elements. Firefox's implementation doesn't respect box-sizing, padding, or width.

Example
<div>
  <label><input type="checkbox" class=""> Check me out</label>
</div>

<div>
  <label><input type="checkbox" class="" value="" disabled> Option two is disabled</label>
</div>

3.1.5 #forms.base.input-radio Radio buttons

If an <input> element has the type="radio" attribute set, the form field is displayed as a radio button.

It's recommended that you don't attempt to style these elements. Firefox's implementation doesn't respect box-sizing, padding, or width.

Example
<div>
  <label><input type="radio" class="" value="option1" name="example-radio" checked> Option one</label>
</div>

<div>
  <label><input type="radio" class="" value="option2" name="example-radio"> Option two</label>
</div>

<div>
  <label><input type="radio" class="" value="option3" name="example-radio" disabled> Option three is disabled</label>
</div>

3.1.6 #forms.base.label Labels

The <label> element represents a caption of a form field. The label can be associated with a specific form control by using the for attribute or by putting the form control inside the label element itself.

Example
<div>
  <label class="" for="lableInputText">A label for a text input</label>
  <input type="text" id="lableInputText" placeholder="Enter some text">
</div>

<div>
  <label class=""><input type="checkbox"> A label wrapped around a checkbox</label>
</div>

3.1.7 #forms.base.select Select list

The <select> element represents a form field for selecting amongst a set of options.

Known limitation: by default, Chrome and Safari on OS X allow very limited styling of <select>, unless a border property is set.

Example
<div>
  <label for="selectDropdown">A standard drop-down</label>
  <select class="" id="selectDropdown">
    <option>Option 1</option>
    <option>Option 2</option>
    <option>Option 3</option>
    <optgroup label="More options">
      <option>Option 4</option>
      <option>Option 5</option>
    </optgroup>
  </select>
</div>

<div>
  <label for="selectMultiItem">A multi-item select field</label>
  <select class="" id="selectMultiItem" multiple>
    <option>Option 1</option>
    <option>Option 2</option>
    <option>Option 3</option>
    <optgroup label="More options">
      <option>Option 4</option>
      <option>Option 5</option>
    </optgroup>
  </select>
</div>

<div>
  <label for="selectDisabled">A disabled drop-down</label>
  <select class="" id="selectDisabled" disabled>
    <option>Option 1</option>
    <option>Option 2</option>
    <option>Option 3</option>
    <optgroup label="More options">
      <option>Option 4</option>
      <option>Option 5</option>
    </optgroup>
  </select>
</div>

3.1.8 #forms.base.textarea Text areas

The <textarea> element represents a multi-line plain text form field.

Example
<div>
  <label for="exampleTextarea">Text area</label>
  <textarea class="" rows="3" id="exampleTextarea"></textarea>
</div>
<div>
  <label for="exampleTextarea">Disabled text area</label>
  <textarea class="" rows="3" id="exampleTextarea" disabled></textarea>
</div>

3.2 #forms.autocomplete Autocomplete field

As the user starts to type a value, a selection list appears below the form item allowing them to choose an option.

Examples
Default styling
  • guwatif
  • hichiuasl

 

.is-throbbing
Waiting for search result.
  • guwatif
  • hichiuasl

 

<input type="text" value="" class="autocomplete [modifier class]">
<div class="autocomplete__list-wrapper">
  <ul class="autocomplete__list">
  <li class="autocomplete__list-item">guwatif</li>
  <li class="autocomplete__list-item is-selected">hichiuasl</li>
  </ul>
</div>
<p>&nbsp;</p>

3.3 #forms.button Button

In addition to the default styling of <button> and <input type="submit|image|reset|button"> elements, the .button class and its variants can apply buttons styles to various elements (like an <a> link).

Examples
Default styling

Link button Disabled link button

:hover
Hover styling.

Link button Disabled link button

:active
Depressed button styling.

Link button Disabled link button

<p>
  <button class="button [modifier class]" type="button">Standard button</button>
  <button class="button [modifier class]" type="button" disabled>Disabled button</button>
</p>
<p>
  <button class="button [modifier class]" type="submit">Submit button</button>
  <button class="button [modifier class]" type="submit" disabled>Disabled submit button</button>
</p>
<p>
  <button class="button [modifier class]" type="reset">Reset button</button>
  <button class="button [modifier class]" type="reset" disabled>Disabled reset button</button>
</p>
<p>
  <input class="button [modifier class]" type="button" value="Input button">
  <input class="button [modifier class]" type="button" value="Disabled input button" disabled>
</p>
<p>
  <input class="button [modifier class]" type="submit" value="Input submit button">
  <input class="button [modifier class]" type="submit" value="Disabled input submit button" disabled>
</p>
<p>
  <input class="button [modifier class]" type="reset" value="Input reset button">
  <input class="button [modifier class]" type="reset" value="Disabled input reset button" disabled>
</p>
<p>
  <a class="button [modifier class]" href="#">Link button</a>
  <a class="button [modifier class]" disabled href="#">Disabled link button</a>
</p>

3.4 #forms.collapsible-fieldset Collapsible fieldset

Fieldsets with optional entry fields can be hidden with collapsed fieldsets.

Examples
Default styling
A collapsible fieldset A summary of the form state
Place the form elements to hide inside this wrapping div.
.is-collapsed
The collapsed fieldset.
<fieldset class="collapsible-fieldset [modifier class]">
  <legend>
    <span class="collapsible-fieldset__legend">
      A collapsible fieldset
      <span class="collapsible-fieldset__summary">A summary of the form state</span>
    </span>
  </legend>
  <div class="collapsible-fieldset__wrapper">
    Place the form elements to hide inside this wrapping div.
  </div>
</fieldset>

3.5 #forms.form-item Form item

Wrapper for a form element (or group of form elements) and its label.

Examples
Default styling
Form item description.
Another form item description.
.form-item--inline
Inline form items.
Form item description.
Another form item description.
.form-item--tight
Packs groups of form items closer together.
Form item description.
Another form item description.
.is-error
Highlight the form elements that caused a form submission error.
Form item description.
Another form item description.
<div class="form-item [modifier class]">
  <label class="form-item__label" for="form-item-input">Label <span class="form-item__required" title="This field is required.">*</span></label>
  <input class="form-item__widget" type="text" id="form-item-input" value="Text value">
  <div class="form-item__description">
    Form item description.
  </div>
</div>
<div class="form-item [modifier class]">
  <label class="form-item__label" for="form-item-input-2">Another label <span class="form-item__required" title="This field is required.">*</span></label>
  <input class="form-item__widget" type="text" id="form-item-input-2" value="Text value">
  <div class="form-item__description">
    Another form item description.
  </div>
</div>

3.6 #forms.form-item--radio Form item (radio)

Checkboxes and radios require slightly different markup; their label is after their widget instead of before. Uses the .form-item--radio class variant of the normal form item and is placed on each of the nested form items.

Examples
Default styling
Form group description.
Form item description.
Form item description.
.is-error
Highlight the form elements that caused a form submission error.
Form group description.
Form item description.
Form item description.
<div class="form-item">
  <label class="form-item__label" for="group">Label for the group</label>
  <div class="form-item__description">
    Form group description.
  </div>
  <div class="form-item__group" id="group">
    <div class="form-item--radio [modifier class]">
      <input class="form-item__widget" type="checkbox" id="option-1" value="1">
      <label class="form-item__label" for="option-1">Option 1</label>
      <div class="form-item__description">
        Form item description.
      </div>
    </div>
    <div class="form-item--radio [modifier class]">
      <input class="form-item__widget" type="checkbox" id="option-2" value="2">
      <label class="form-item__label" for="option-2">Option 2</label>
      <div class="form-item__description">
        Form item description.
      </div>
    </div>
  </div>
</div>

3.7 #forms.progress-bar Progress bar

Shows the progress of a task in a simple bar graph.

Examples
Default styling
60%
Installing...
.progress-bar--inline
An inline progress bar.
60%
Installing...
<div class="progress-bar [modifier class]">
  <div class="progress-bar__bar"><div class="progress-bar__fill" style="width: 60%"></div></div>
  <div class="progress-bar__percentage">60%</div>
  <div class="progress-bar__message">Installing...</div>
</div>