Add help blocks with inputs when necessary, especially when users may not fully understand the purpose of the input
Place constructive action buttons on the right, and deconstructive action buttons on the left of the form
If necessary, place short, related inputs on the same line (e.g., City and State, Start and End, Min and Max)
Ensure that unsaved changes are not easily lost
Don’t
Use placeholders as the only label
Place unrelated inputs on the same line
Field widths
Field widths should communicate the expected or max length of content. Use consistent, non-arbitrary widths to help with alignment. These widths apply to similar controls like selects, date inputs, dropdowns, and sliders. These widths may not be appropriate in some situations or layouts.
Labels
Form labels can either go above or beside the input, depending on the space constraints. If you are horizontally constrained, place the labels above the input, otherwise, place the labels beside the input. In a responsive design, labels should automatically reposition themselves depending on the space available.
Do
Ensure that clicking on a label focuses the corresponding input
Use sentence capitalization for labels
Use concise labels name
Use the user’s language for labels
Be consistent with label positioning (above/beside)
Be consistent with questions or statements labels
Don’t
Use colons after labels
Vertically aligned labels
Labels are placed above the inputs, left aligned.
Horizontally aligned labels
Labels are to the left of the input, right aligned.
Required fields
Required fields are generally marked with an asterisk. For external, public facing forms, put a * indicates required message. For internal applications containing many forms or targeting power users, the * indicates required may not be necessary. Ensure that required fields are validated with appropriate feedback.
If the majority of the fields are required, consider adding (optional) to the optional fields instead of asterisks on the required field.
Vertically aligned labels
When labels are vertically aligned, the asterisk is placed on the right.
Horizontally aligned labels
When the labels are horizontally aligned, the asterisk is placed to the left.
Form validation
There are two main types of form validation, often used together.
Field level: Validation errors appear directly below the field with errors (e.g., This field is required.)
Form level: Validation errors appear at the top or bottom of the form (e.g., The email or password you entered is incorrect., and Please fix the 3 errors.)
For input fields that are cramped, you may need to resort to using a popover error message.
Do
Scroll to and focus the first field with an error when the submit button is pressed.
Provide validation feedback as soon as possible, either 500ms after a key is pressed, when the field loses focus, or (if all else fails) when the form is submitted.
Provide field level validation for fields that are known to be invalid
Provide form level validation for large forms, or when the system doesn’t know exactly which field is invalid
Describe why an error occurred (e.g., Email is already in use rather than There was an error)
Describe/imply what the user should do to fix the error
Don’t
Cause the form to ‘bounce’ as validation errors show/hide while the user is typing
Include technical jargon in errors
Help text
Help text can be placed at the top of the form, under the heading of a form group, under an individual form field, or as a popover when the field is focused.
Place help text at the top of the form to give information that relates to the entire form
Place help text under the heading of a form group to give information that relates to that form group alone
Place help text beside or under an individual form field that relates to that field alone
Use a popover on an input field (text box, text area, or select) for help text that is lengthy, complex, non-critical, or when screen real estate is limited. Too much help text can make a form look and feel busy and difficult.
Form groups
If you have many fields, consider organizing related fields into groups. Groups can have a title.
Input character limits
Most input fields have technical character limits. The system should handle this gracefully in all scenarios.
Text box
In most cases, simply ignore key presses that exceed the limit
Text area
If the limit is low or the expected input size is unknown, include a limit indicator
Update the limit indicator on each key press
Allow the user to keep typing past the indicator, but provide obvious indications that the limit has been exceeded.