Components · Forms · Password
Back to Password typesPassword
Use for collecting a secret value that should stay hidden while typing, like a password, passphrase, or PIN.
Properties
Size, corner radius, label, placeholder and the reveal toggle are properties of the same component, not separate fields - change them below to check this field's style and states in the Live Preview.
Live Preview
All 3 types compared side by side, each in all 6 states. One full matrix is rendered per selected combination of Size and Corner radius - check more than one option in a dropdown to see every combination side by side.
When to use
Any form field that collects a secret value the user is typing, where the characters should stay hidden by default.
Validation
Password carries the same validation contract as any required field, plus rules specific to secrets - what counts as a valid value, when to check it, and how to keep autofill and password managers working rather than fighting them.
- Required marking - mark a required password field the same way as any other required field in this system (red asterisk after the label) - this is separate from and in addition to the reveal toggle, which is about visibility, not requiredness.
- Validation timing - never flag length or format errors while the user is still typing; validating on every keystroke reads as hostile and punishes someone mid-password. Check on blur or on submit instead. A live, non-error checklist of requirements met so far (green checks, not red errors) is fine and encouraged if space allows - it affirms progress without accusing the user of a mistake they haven't finished making.
- Autofill and paste - set the correct
autocompletevalue (current-passwordon login,new-passwordon signup or change-password) so browser and OS autofill and password managers can fill the field correctly. A value placed by autofill or paste must be validated exactly like one typed by hand - never skip or weaken validation just because the value didn't arrive via keystrokes. Per WCAG 2.2 Success Criterion 3.3.8 (Accessible Authentication - Minimum), the field or flow must never require solving a cognitive-function test - transcribing a puzzle, remembering something from elsewhere, doing mental math - as the only way to authenticate, so pasting the password or accepting a password-manager fill must always work; never attach paste-blocking oncopy/onpaste handlers to this field. - Error message - state the rule directly and specifically: "Password must be at least 12 characters," not "Invalid password" or "Oops! Something went wrong." The user should be able to fix the value from the message alone, without guessing at what "invalid" means.
- Recovery - the show/hide reveal toggle is the primary recovery aid for a failed validation: let the user reveal what they actually typed and compare it against the error message, rather than clearing the field and forcing them to retype blind.
Component Guide
Overview
Password is a text field that masks its characters by default, with a toggle to reveal the value temporarily - used for any secret the user is actively typing, so it stays hidden from anyone glancing at the screen while still letting the user verify what they typed.
When to Use
- Login and sign-up forms - collecting an account password.
- A PIN code or short secret - still worth masking even if numeric.
- Changing a password or entering an API key - any value that shouldn't be visible by default.
When Not to Use
- A value that isn't actually secret - use Input - masking non-sensitive data only adds friction.
- A one-time code delivered separately and meant to be read back to someone - consider whether masking helps or just adds a step; a plain Input or Number field may serve better.
- Multi-line secret content - Password is single-line only; there's no dedicated masked textarea in this system.
Best Practices
- Always provide the show/hide toggle - masking with no way to verify what was typed increases error rates and failed submissions.
- Never restrict paste into a password field; blocking paste actively discourages the use of password managers.
- Show password strength or requirement feedback near the field, not only after a failed submit.
Do and Don't
Do
At least 12 characters.
States the rule before the user types, and lets them reveal what they entered so a typo is fixable rather than guessable.
Don't
Password does not meet requirements.
Hiding the rule until after submission, with no way to see what was typed, makes the user retry blind against a standard they still have not been told.
Accessibility
- The show/hide toggle has an accessible name that reflects its current state ("Show password" / "Hide password"), not just an icon.
- Toggling visibility keeps keyboard focus on the field, so the user isn't forced to re-locate it.
- The input still exposes autocomplete hints (current-password / new-password) so password managers can assist correctly.
Related Components
Input, Number (for PIN-style numeric-only secrets), Text Area.
{
"component": "Password",
"category": "Forms",
"summary": "Password is a text field that masks its characters by default, with a toggle to reveal the value temporarily - used for any secret the user is actively typing, so it stays hidden from anyone glancing at the screen while still letting the user verify what they typed.",
"whenToUse": [
"Login and sign-up forms - collecting an account password.",
"A PIN code or short secret - still worth masking even if numeric.",
"Changing a password or entering an API key - any value that shouldn't be visible by default."
],
"whenNotToUse": [
"A value that isn't actually secret - use Input - masking non-sensitive data only adds friction.",
"A one-time code delivered separately and meant to be read back to someone - consider whether masking helps or just adds a step; a plain Input or Number field may serve better.",
"Multi-line secret content - Password is single-line only; there's no dedicated masked textarea in this system."
],
"bestPractices": [
"Always provide the show/hide toggle - masking with no way to verify what was typed increases error rates and failed submissions.",
"Never restrict paste into a password field; blocking paste actively discourages the use of password managers.",
"Show password strength or requirement feedback near the field, not only after a failed submit."
],
"doAndDont": {
"do": "States the rule before the user types, and lets them reveal what they entered so a typo is fixable rather than guessable.",
"dont": "Hiding the rule until after submission, with no way to see what was typed, makes the user retry blind against a standard they still have not been told."
},
"accessibility": [
"The show/hide toggle has an accessible name that reflects its current state (\"Show password\" / \"Hide password\"), not just an icon.",
"Toggling visibility keeps keyboard focus on the field, so the user isn't forced to re-locate it.",
"The input still exposes autocomplete hints (current-password / new-password) so password managers can assist correctly."
],
"relatedComponents": [
"Input",
"Number",
"Text Area"
]
}