The Core style set lets you easily construct forms that follow the standard form layout and design.
Note: This documentation assumes that you have an understanding of how HTML forms work. It will not go into detail
as to how forms are constructed, but rather explain the specifics of the Core-related form styles.
If you want to build a standard form, you will need to apply the class form to your form element.
Form Themes
There are different themes available for your forms. They are applied with a form-theme-* class
on the form element.
With no specific theme defined, your form will have a transparent background. Adding a theme will
give your form a colored background and apply certain other visual effects, like separators between
fieldsets, paddings, rounded corners, etc.
Form themes will only alter the appearance of the form wrapper and its fieldsets. Everything else is up to the developer.
Standard Form Theme
This is the standard form theme for forms on light backgrounds.
White Form Theme
The white form theme is for forms that are set on dark backgrounds.
Form Structure
Forms are structured using the grid layout described in the Grid section.
All inputs are 100% wide in the standard form layout. You can adjust their sizes
through the grid items that they are wrapped in.
Form Elements
There are standard definitions for all common form elements. The sections below will show examples of each.
Text Inputs
All text inputs, including type="email", type="tel", etc., get the class input-text.
You can attach unit icons to your text inputs to give the user an additional hint about what is asked of him.
To apply a unit icon, give your text input the additional class input-unit and insert a
FontAwesome icon after it with the class unit-icon.
Input Sizes
You can adjust the size of your form inputs by applying the
font size classes to them.
Select Fields
Select fields get the class select.
Radio Buttons
For radio buttons, the input gets the class input-radio and the label gets the class
label-radio.
Checkboxes
For checkboxes, the input gets the class input-checkbox and the label gets the class
label-checkbox.
Submit Buttons
You can use any of the globally available buttons as form submit buttons. Please see the
Buttons section for more information.
Move buttons around with the float-* classes.
Cancel Link
If you wish to offer a way to cancel the form or go back to a previous step, insert a regular link with the
cancel class alongside your submit button.
Errors
You can highlight faulty input by adding the error class to an input field.
Labels for Required Inputs
Attaching the class required to labels will (visually) designate the corresponding input as required.
Status Messages
If you want a form to give feedback to the user, you may use one of the four status messages.
Please see the Status Messages section for a full description.
HTML5 Validation
The HTML5 Constraint Validation API brings some
powerful (if not yet consistently supported) tools to validate a user's form input on the client side.
We recommend using the Webshims polyfill as a fallback for
legacy browsers who do not natively support the HTML5 Validation API.