Overview
When implementing a form that has required and optional fields, care should be taken to ensure a consistent and predictable experience.
- Mark all required fields
- Ensure there is a description at the top of the form
- Place the required indicator at the end of the field label
- Use the correct ARIA attributes
- Mark optional fields
- Use the placeholder text to indicate a field is required
Exceptions
In certain circumstances it’s ok to not mark required fields, these include:
Implementation
Required fields should be indicated using the following 3 methods:
1. At the top of the form ensure there is a message indicating there are required fields:
html
Copy
2. The label text must have the required indicator <abbr class="--required" title="required">*</abbr> at the end:
html
Copy
3. Each required field must have the required and aria-required="true" attributes:
html
Copy
Examples
html
Copy
html
Copy