key access, access code, ID, registration, login, sign up
Password
Description
A password captures the personal code entered by a user when creating an account or logging in to an existing account.
Anatomy
Anatomy
Size
Height
- Choose the most suitable height based on context, space, and screen size.
- Note that font size, padding, and spacing differ according to the field height that you choose.
- For guidance on the spacing between form inputs, see the form pattern.
Width
- Choose the width of the form input to fit the content or the parent container.
- Fit to content. Make the form input wide enough to display expected input (without a lot of white space) rounded up to the nearest 8 pixels.
- Set container width. Make the form input width a percentage of the parent container width (usually 100 percent or 50 percent).
- Be consistent.
- Do not allow an input container to stretch to a very large width.
States
Component-specific states
Empty
Obscured
Visible
Variations
Default
Hint text
Requirements list
Color mode
Password
Password
Dos and don'ts
Do
Do
Do
Do
Don't
Do
Examples and other best practices
Create account
Handling incorrect login attempts
Forgot password
Change password
Other names
Key access, access code, ID, registration, login, sign up.
Technical example
Password requirements checker
- Use bullet points to list the password requirements and keep them visible when the component is selected.
- Include information about symbols, types of characters, case sensitivity, special formatting, size, range, or length restrictions.
Requirement text examples
- Minimum of [number] characters
- At least 1 capital letter
- At least 1 number
- At least 1 special character
Hint text
- If paired with the password requirements checker, use hint text to generally describe what a password should be.
- For example, that it must be a strong or long password.
- Do not describe specific requirements in the hint text.
- End hint text with a full stop if possible. This makes screen readers pause before reading out any error or warning message after the hint text.
Error messages
- Do not use specific error messages if they will cause duplication of content. For example, referencing text in the password requirements checker.
- Instead, use a generic error message to communicate the problem and how to fix it.
| Use case | Example error messages |
|---|---|
| Incorrect characters used when creating password. | Password not accepted. Check requirements and try again. |
| Incorrect password entered for existing account. | The login details are incorrect. Check details and try again. |
| Too many attempts to log in with an incorrect password. | Too many attempts to log in with an incorrect email or password. Try again in [number] minutes. |
Password reset
| Use case | Example text |
|---|---|
| Forgotten password | Enter your registered email address and we'll send you instructions to reset your password.Copy and paste the authorisation code from the password reset email that we sent you. |
| Changed password | Enter your new password to log in to Sage. |
Requirements
Users should be able to:
- Enter or create a password using assistive technology.
- Understand password requirements before and during password creation.
- Toggle the visibility of a password.
Interactions
Users should be able to toggle the visibility of their password, as some users with cognitive impairment may find it difficult to remember what they have typed if they are unable to see the password.
Users should also be allowed to copy and paste their passwords into a field, or autofill passwords from a password manager. This can help some users with motor impairments or memory limitations.
Keyboard interactions
- Tab. Moves focus from the previous interactive element on the page to the password input field.
- Users should be able to type or copy and paste into the password field.
- Pressing tab again moves focus to the visibility toggle.
- Space. Pressing space on the password toggle toggles the visibility of the password field.
- Enter. Pressing enter on the password input submits the password form.
Design considerations
- Avoid overly strict password requirements, as this can make it more difficult for users to remember their passwords.
- Avoid using color alone to communicated that passwords are incorrect or that requirements have not been met. Use additional visual cues to relay this information.
- Make sure the borders of the input have a 3:1 minimum contrast ratio with the background.
- The visibility toggle button should have clear, visible button name, given by the inner text.
Development considerations
- The input field should have a visible label, associated with the password field using the for attribute, pointing to the id of the password field.
- The input field should have , so it inherits the secure input of password field types.
- The button to toggle the visibility of a password should have a clear aria-pressed state to communicate the current state to screen reader users.
- Hint text communicating password requirements should be associated with the password field using aria-describedby.
- Use the autocomplete attribute to allow users to autofill passwords.
- For a new password, the new-password token should be used.
- For an existing password, the current-password token should be used.
- Use the required attribute to communicate to screen reader users that a password is required.
- If the password requirements are dynamic, any updates should be communicated to screen reader users using an aria-live region, relaying the changes or updates.
| Date | Changes |
|---|---|
| October 2025 | Added image for light color mode.Converted dynamic state to static.Updated headings for example assets. |
| August 2025 | Updated guidance on the accessibility tab. |
| October 2024 | Added a dynamic Password checker below the Hint text. |
| September 2024 | New version created. Previous version archived in the frozen Product design system. |