Password input
These examples are used for automated tests and may not follow service manual best practice.
Code
Markup
<div class="nhsuk-form-group nhsuk-password-input" data-module="nhsuk-password-input">
<h1 class="nhsuk-label-wrapper">
<label class="nhsuk-label nhsuk-label--l" for="example">
Password
</label>
</h1>
<div class="nhsuk-input-wrapper">
<input class="nhsuk-input nhsuk-password-input__input nhsuk-js-password-input-input" id="example" name="example" type="password" spellcheck="false" autocomplete="current-password" autocapitalize="none">
<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--small nhsuk-password-input__toggle nhsuk-js-password-input-toggle" data-module="nhsuk-button" type="button" aria-controls="example" aria-label="Show password" hidden>
Show
</button>
</div>
</div>
Macro
Password input with autocomplete attribute
Open this example in a new tab: Password input with autocomplete attribute
Code
Markup
<div class="nhsuk-form-group nhsuk-password-input" data-module="nhsuk-password-input">
<h1 class="nhsuk-label-wrapper">
<label class="nhsuk-label nhsuk-label--l" for="new-password">
Password
</label>
</h1>
<div class="nhsuk-input-wrapper">
<input class="nhsuk-input nhsuk-password-input__input nhsuk-js-password-input-input" id="new-password" name="example" type="password" spellcheck="false" autocomplete="new-password" autocapitalize="none">
<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--small nhsuk-password-input__toggle nhsuk-js-password-input-toggle" data-module="nhsuk-button" type="button" aria-controls="new-password" aria-label="Show password" hidden>
Show
</button>
</div>
</div>
Macro
Code
Markup
<div class="nhsuk-form-group nhsuk-form-group--error nhsuk-password-input" data-module="nhsuk-password-input">
<h1 class="nhsuk-label-wrapper">
<label class="nhsuk-label nhsuk-label--l" for="with-error-message">
Password
</label>
</h1>
<p class="nhsuk-error-message" id="with-error-message-error">
<span class="nhsuk-u-visually-hidden">Error:</span> Enter a password
</p>
<div class="nhsuk-input-wrapper">
<input class="nhsuk-input nhsuk-input--error nhsuk-password-input__input nhsuk-js-password-input-input" id="with-error-message" name="example" type="password" spellcheck="false" aria-describedby="with-error-message-error" autocomplete="current-password" autocapitalize="none">
<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--small nhsuk-password-input__toggle nhsuk-js-password-input-toggle" data-module="nhsuk-button" type="button" aria-controls="with-error-message" aria-label="Show password" hidden>
Show
</button>
</div>
</div>
Macro
Password input with hint
Open this example in a new tab: Password input with hint
It probably has some letters, numbers and maybe even some symbols in it
Code
Markup
<div class="nhsuk-form-group nhsuk-password-input" data-module="nhsuk-password-input">
<h1 class="nhsuk-label-wrapper">
<label class="nhsuk-label nhsuk-label--l" for="with-hint-text">
Password
</label>
</h1>
<div class="nhsuk-hint" id="with-hint-text-hint">
It probably has some letters, numbers and maybe even some symbols in it
</div>
<div class="nhsuk-input-wrapper">
<input class="nhsuk-input nhsuk-password-input__input nhsuk-js-password-input-input" id="with-hint-text" name="example" type="password" spellcheck="false" aria-describedby="with-hint-text-hint" autocomplete="current-password" autocapitalize="none">
<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--small nhsuk-password-input__toggle nhsuk-js-password-input-toggle" data-module="nhsuk-button" type="button" aria-controls="with-hint-text" aria-label="Show password" hidden>
Show
</button>
</div>
</div>
Macro
Password input with hint and error
Open this example in a new tab: Password input with hint and error
It probably has some letters, numbers and maybe even some symbols in it
Code
Markup
<div class="nhsuk-form-group nhsuk-form-group--error nhsuk-password-input" data-module="nhsuk-password-input">
<h1 class="nhsuk-label-wrapper">
<label class="nhsuk-label nhsuk-label--l" for="with-error-message">
Password
</label>
</h1>
<div class="nhsuk-hint" id="with-error-message-hint">
It probably has some letters, numbers and maybe even some symbols in it
</div>
<p class="nhsuk-error-message" id="with-error-message-error">
<span class="nhsuk-u-visually-hidden">Error:</span> Enter a password
</p>
<div class="nhsuk-input-wrapper">
<input class="nhsuk-input nhsuk-input--error nhsuk-password-input__input nhsuk-js-password-input-input" id="with-error-message" name="example" type="password" spellcheck="false" aria-describedby="with-error-message-hint with-error-message-error" autocomplete="current-password" autocapitalize="none">
<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--small nhsuk-password-input__toggle nhsuk-js-password-input-toggle" data-module="nhsuk-button" type="button" aria-controls="with-error-message" aria-label="Show password" hidden>
Show
</button>
</div>
</div>
Macro
Password input without page heading
Open this example in a new tab: Password input without page heading
Code
Markup
<div class="nhsuk-form-group nhsuk-password-input" data-module="nhsuk-password-input">
<label class="nhsuk-label" for="without-heading">
Password
</label>
<div class="nhsuk-input-wrapper">
<input class="nhsuk-input nhsuk-password-input__input nhsuk-js-password-input-input" id="without-heading" name="example" type="password" spellcheck="false" autocomplete="current-password" autocapitalize="none">
<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--small nhsuk-password-input__toggle nhsuk-js-password-input-toggle" data-module="nhsuk-button" type="button" aria-controls="without-heading" aria-label="Show password" hidden>
Show
</button>
</div>
</div>
Macro
Code
Markup
<div class="nhsuk-form-group nhsuk-password-input" data-module="nhsuk-password-input" data-i18n.show-password="Datguddia" data-i18n.hide-password="Cuddio" data-i18n.show-password-aria-label="Datgelu cyfrinair" data-i18n.hide-password-aria-label="Cuddio cyfrinair" data-i18n.password-shown-announcement="Mae eich cyfrinair yn weladwy." data-i18n.password-hidden-announcement="Mae eich cyfrinair wedi'i guddio.">
<h1 class="nhsuk-label-wrapper">
<label class="nhsuk-label nhsuk-label--l" for="password-translated">
Cyfrinair
</label>
</h1>
<div class="nhsuk-input-wrapper">
<input class="nhsuk-input nhsuk-password-input__input nhsuk-js-password-input-input" id="password-translated" name="example" type="password" spellcheck="false" autocomplete="current-password" autocapitalize="none">
<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--small nhsuk-password-input__toggle nhsuk-js-password-input-toggle" data-module="nhsuk-button" type="button" aria-controls="password-translated" aria-label="Datgelu cyfrinair" hidden>
Datguddia
</button>
</div>
</div>
Macro
Code
Markup
<div class="nhsuk-form-group nhsuk-password-input" data-module="nhsuk-password-input">
<h1 class="nhsuk-label-wrapper">
<label class="nhsuk-label nhsuk-label--l" for="width-class">
Password
</label>
</h1>
<div class="nhsuk-input-wrapper">
<input class="nhsuk-input nhsuk-input--width-10 nhsuk-password-input__input nhsuk-js-password-input-input" id="width-class" name="example" type="password" spellcheck="false" autocomplete="current-password" autocapitalize="none">
<button class="nhsuk-button nhsuk-button--secondary nhsuk-button--small nhsuk-password-input__toggle nhsuk-js-password-input-toggle" data-module="nhsuk-button" type="button" aria-controls="width-class" aria-label="Show password" hidden>
Show
</button>
</div>
</div>