Form groups are used to assemble form elements with labels, messages, and help containers.
These components can be used alone. For example, the form__item element with the label and control could be used without the full form group since not every form field will need error messages.
Inputs
A text input field allows users to enter and edit text or numeric values in one line. To help users enter a valid value, it provides additional features like “auto-complete”, “suggestions”, and “value help”.
Use aria-required="true" for form fields that are required. A red astrisk will render to indicate that the field is required to the user.
Use the input field if:
The user needs to enter a short, single-line text or numbers, dates or times.
The user needs to select one or more items from a list of items, such a a multi-input.
The user needs to find one or more items out of a list of items by searching for more than one attribute, such as a combobox.
Do not use the input field if:
The user needs to enter long texts. In this case, use the textarea.
The user needs to carry out a search. In this case, use the search field.
Input States
The state of the input field can reflect validity of the data entered, whether the input data is editable or disabled.
Normal: The field is editable but no validation has occurred
Information: Draws attention to the field with a netural color
Valid: The data format entered has been validated and it’s correct, such as an email address.
Invalid: The data entered is not valid and must be corrected.
Warning: The data entered is formatted correctly but there are other issues are problematic but will not stop the user from moving forward.
Disabled: This indicates the field is not editable. A common use case is that this field is dependent on a previous entry or selection within the form.
Read Only: Used to display static information in the context of a form.
Along with Invalid and Warning, error messages should be displayed below the field so the user can correct the error and move forward.
Pellentesque metus lacus commodo eget justo ut rutrum varius nunc
Pellentesque metus lacus commodo eget justo ut rutrum varius nunc
Pellentesque metus lacus commodo eget justo ut rutrum varius nunc
Pellentesque metus lacus commodo eget justo ut rutrum varius nunc
Pellentesque metus lacus commodo eget justo ut rutrum varius nunc
Message with no icon
Using the fd-form__message--no-icon modifier will render the message without any icons.
The inline help element is displayed as a ? Icon. On hover or click, help content is displayed.
Help content can also be visible at all times to avoid mistakes. This type of help generally contains validation rules about the data allowed in the input field. An example is “Maximum 20 characters”. This is displayed below the input field.
Pellentesque metus lacus commodo eget justo ut rutrum varius nunc
Pellentesque metus lacus commodo eget justo ut rutrum varius nunc
Pellentesque metus lacus commodo eget justo ut rutrum varius nunc
Pellentesque metus lacus commodo eget justo ut rutrum varius nunc
Inputs help elements
Help elements give the user information about the input. Two types of help elements can be used.
The inline help element is displayed as a ? Icon. On hover or click, help content is displayed.
Help content can also be visible at all times to avoid mistakes. This type of help generally contains validation rules about the data allowed in the input field. An example is “Maximum 20 characters”. This is displayed below the input field.
Pellentesque metus lacus commodo eget justo ut rutrum varius nunc
Textarea
Use the text area if you want users to enter multiple lines of unformatted text.
Do not use the text area if
You only want them to enter a single line of text, use the input control instead.
Users need to enter formatted text. Use the rich text editor instead.
Select
The Select component is similar to a dropdown but is more commonly used within a form. It can also be set to a disabled state.
Radio buttons
Radio buttons provide users with a set of mutually exclusive options. They allow a user to select only one option from two or more choices. Each option is represented by a radio button. Consequently, radio buttons only work in groups.
Use the radio button if:
You need to help users choose quickly between at least two clearly different choices.
Do not use the radio button if:
You need to offer the user the option of multiple selection. In this case, use checkboxes instead because radio buttons are for single-selection contexts only.
You need to present more than 8 options. Use a dropdown box or list view.
In special cases, there are only two mutually exclusive options. Combine them into a single checkbox or toggle switch. For example, use a checkbox for “I agree” (for example, to terms and conditions) instead of two radio buttons for “I agree” and “I don’t agree”.
The options are numbers with fixed steps. Use a slider control.
Checkbox
With checkboxes, all options are visible and the user can make one or more selections. This component can be set disabled and also displayed in a row.
Use the check box if:
Only one option can be selected or deselected, for example to accept terms of use. Use it only if the meaning is obvious.
A group or a list of options can be selected independently of each other.
All available options need to be displayed right away without any user interaction.
An intermediate selection state (Tri-State) is required when multiple sub-options are grouped under a parent option. The Tri-State will represent that multiple (but not all) sub-options are selected in the list.
Do not use the checkbox control if:
The user needs to choose multiple options from a large list. Use a multi-combo box instead.
The user can choose only one option from a list. Use a radio buttons, a select, or a list instead.
The user needs to perform instantaneous actions that do not need reviewing or confirming. Consider using the switch control instead.
There is not enough space available on the screen. Use the combo box control instead.